Refactored addDocument/s method.