Change all the config variables to $GLOBALS array
Added some debug output