slight changes in looping over input file arrays