Solved exercise 3.12