Updated the source code of the Document Model, unit tests added.