Implement equals() and hashCode()

Hopefully the hash function will be good.