Changed the way toString, hashCode and equals are implemented.