Changed organization and order of generated code.