Improved diagnostics API and did some general code clean-up