Rework Document/Collection classes
Fix tests