[refactoring] split code generator to 2 files
minor codegenerator refactor