a version of ex1_6 completed