simplified algorithms by rewriting potentialNextTasks