Corrected heuristic sorting order.