Refactored call to a function, to make it testable