improved code generation