changes based on PR feedback
Add mores test, fix issue where document revisions were being freed before being used