Made some slight adjustments to the debug code