Move internal functions to helpers module