copied ex6 from book