First crack at fixing sorting.