added the data export to csv, did some generalization