moving more functions to a higher scope