Fixed document templates
Added support for document templates