Various small changes to support diagnostic search