Getting rid of tasks_sorted in favor of tasks for task index