added debug output mode for whole documents