refactor

removes the never-used function argument, and lifts the processing functions out of the for loop.