Modify exercise 4.39