simplified generated code (removed redundancies)