Refactoring Compas code-gen: part 3