Fixed crash with debug.  Encapuslated debug functions into single namespace