adding better support for sessions