equalkey can no longer return -1, simplify code