change module function signature to accept `global` object