Correctly loop over arrays.