Added testing code for debug mode