added debug control which will not toggle outside of debug mode