refactor exporting data