Switch a bunch of loops to range fors.