Move variable declarations outside loops.