equals function tweaked a bit in water