Added a session helper function