Added Diagnose helper function