Solve Exercise 3.22