Modular approach for exporting different format

Hi, I did a little bit refactoring to allow easy addition of more
formats for export. the export options can now be moved to another place
easily if needed.