Small refactor for testability.