Clean up diagnostic junk and unused code.