source formatting, change template validation to return a TemplateResponse