[Diagnostics/Profiling] Docblocks and minor refactoring.