Finish exercise 3.6 to 3.11