Finished adding code from Chapter 18.