Added initial code for diagnostics