Removing document and file count from addDocument, and some cleaning up.