Completed demo from book, chapter 2