Move variable declarations outside looops.