Reordered generated code to make changes smaller