Added some code for sessions