adding cosine similarity helpers and test