amend the readCorpus function