sunny's code for pruducing csv files