Finish the Chapter5 exercise