Refactored tests and test document to run on a collection of docs