init commit for chapter16
chapter 16
ran successfully
modified to only call write function once