Started work on writeData. See files for link.