Implemented hashCode and equals methods.