Exercise 6.13: Reformatted code a little.