Replaced task.sequence with $index