Revised naming of keys and arrays in foreach loops