Added code which maintains number of term occurrences and document