move segment functions, but not requests yet, to module