Slightly simplified sorting.