Refactored templates and TemplateUtil