Added support for document templates.