adding a debug function