some codegen rework