added changes for chapter 3
added changes for chapter 3 and fixes