More TemplateContext refactorings. refs #459