Further refactoring of TemplateComponent