First version, trimming TemplateElements