Implemented equals and hashcode.