Improved code generation