Added applyTemplateData and tests