it appears that all the functions in this file are globally defined. Should they be namespaces?