improved last chapter 21 example