similarity function

finished similarity function