9.3.4 - partial refactoring, first get tests to pass