Moved session logic