Separate codegen from model