Solve exercise 5.7