completed cosine similarity method