first working version of new session management