sort multiplicity cells according to alphabetic order; refactor the code to use comparator in sorting