Sorting of tasks