working examples from chapter 2