Writing to CSV

Updating code to properly write to CSV - currently not updating touch
variables as they should.