Move common functions to a component and out of the global namespace