Add equals and hashcode and tests