Completed chapter 4 1st draft code.