Add sort and partition.