Added write_data_to_csv, moving some things around

Write data in dict form to a CSV file which may be read in.