Reordered the tasks to be more efficient