Changed the debug logic to something more logical.