move functions so they are available for the functions that use them