added logging to csv files