Refactoring.  All tests passing.