first implementation of exporting to csv