Add stable sorting.