commutative group solver written. To be tested now!