refactor transport and session