More improvements to thread-referral.