demo code from book