added sorting for tasks