refining the codegen