Completed the sorting