committing final exercise from chapter 2