more work on TemplateEngine