Updated debug function.