re-ordered session logic