Add equals and hashCode methods.