Final version with debug message