Changed TemplateWindow to TemplateDialog