Move import/export around and first pass at general referral export