Referral code table

Moved the code into the ReferralCode so that a user can have multiple referrals from a single referral code.