Replacing index exrepssion of only the current loop instead of all loops.