Listing 11.22. All tests pass.