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

Modularizing and code clean up
-- Global variables and functions are set in the globals.py