refactoring for TemplateNotFoundException