Refactoring of export (csv,ris,txt) code