added check for referrals