improvement on chapter 5