added contracts
refactor: reformat

Added contract
enhance: added equals and hashcode methods

Always override equals and hashcode methods as good practice