almost there, struggling with similarity function