Introduce more diagnostic infrastructure
wip