Did some refactoring to make the code more readable
Optimized the Factory path for Documents (in DocumentCollection)
Merge remote-tracking branch 'Roland's/perftest' into nathan