modified so we can use cosine similarity