Added equals and hashcode methods.
Fixed failing tests.