Produce valid CSV (gh-23)

The previous method of dumping out CSV data was a grotesque hack.
This is waaaaay more sane.