diag: minor cleanup

WIP.

This has not been tested.