TemplateEngine improvements