update code chapter 1