Implementation with debug code