move cosine similarity and creating terms corpus in separate classes, small optimisations