finished code example in section1 and first example in section2, chapter9