Some improvements to how the document converter works