make this DRY if you could with `get_doc_template`?