eliminates global method by moving functions to module level