modify the similarity algorithm