Added some more hashCode() and equals() methods to avoid unwanted duplicates in HashSets.