Refactoring Compas code-gen: part 2