TemplateFactory  - tags added, mild refactoring