New debug function