#15 refactored TemplateService.