Made changes for new packet format
Added support for writing to CSV files