Simplify the similarity function