Implemented TemplateDef class. refs #418