get_equivalence_classes - attempt II