change the assignTasks logic