refactor to make more easy to add new document types