Added CSV write (compiles, but untested with app)