export to file with different options, refactoring