Move hidden functions into the main scope

Hidden functions are difficult to test and should be avoided.