Basic working version for submitting ref codes as existing user. Doesn't  yet correctly work in all cases.