Improve generated code