Fixing use of global to use $GLOBALS