Cosine similarity function added