split out codegen