Add some extra diagnostics and simplify.