Refactored diagnostics module