Even more edits

Fixed writing to file and added data collection files.