Modify Exercise 5.40