Implement #50; fix minor bug with CSV generation