Output to CSV

These are the changes that allow separate csv files to be output after
each run. Formatting was changed as well.