Make EquivalenceClass an inner class.
Improve output formatter.