Add referral algorithm