Clean-up __eq__ and __hash__ implementations slightly.