Added a reordering pass to to_cells.c

Non-strictly-ordered expressions will now be reordered as part of cell
conversion.