made debug handlers with printing switch