added chapter 1 code