implemented proper hashCode and equals methods