Updated the way that the data is written out and added a few more options