implemented sorting of the workload