utils.js for testability