Implement FreemarkerGenerator
codegen refactor