testing code from book