minor changes in looping through files