initial untested code for chapter_3