Added global switch to toggle debugging mode