Exercise 4, complete with extra credit.