iterator needs to be given a new variable inside a for loop for a Task function, since Task shows the value of i at the time the task is executed, not when created.