Add diagnostics functions.