PMO-2689: refactored for testability