- Tasker: moved init of tidx outside the loop since it only needs to be done once