refactor flow_to_transit