Refactoring such as creating a sole templateGroupCreated() function, template groups as fields and removing unnecessary usesProductionTemplates().