This is now duplication between here and parseDoc, only one should be needed