adding debug on/off support to distributed code (incomplete)