Re-factor debug message system