Solved exercise 8