use array for output files; make final merge optional