re impl session, done, not tested