Refactored code generator file.