added session logic