Finish chapter9 exercise [WIP]