finished ch5 and ch8, plus one code for ch9