Refactoring.  All tests pass.

Change-Id: If01d0c6444488ce6a4d67c70f2dd844b13ff536b