Made some improvement to the document analyser (parser)