Moved the local variable into the loop.