Move variable declaration to inside of loop.