added a bunch of debug code detection.