refactoring to allow full test coverage