Slight cleanup of discovery implementation.