MX lookup failures handled better.

Refactored /publickeys/query code