Implemented calcSimilarity