converted to module function