Added open and closed session functionallity