Refactor after comments

- Use document id and document_type in the generated cdv
- Look up document with id