ML: session logic added