Fixed issue #32 by handling different document types in the document template.