implementing debug code