The index (i) was being redefined, but is needed for parallelization