I agree this approach would make things much simpler! I didn't want to change document parsing too much in the context in this PR, do you think it is something that could be done later?