Exercise 5.4, naive implementation