Improve portal transit function.