Refactor diagnostic hierarchy