Refactoring on code generator functionality.