An example of refactoring towards better testability...