refactor workflow for referral to take into account CBA nad emergent/non-emergent case better