Added option to flatten output files and store order run