Added writing a csv, preparing for d3 graph