Added CSV writing
Merge pull request #16 from emhart/master

fixed CSV writing