better export-file formatting, refactoring