Completed exercise 3 of chapter 4.