modify equals method and add hashCode method