code clean up . global variables and functions  are defined  in globals.py