add session control logic