added session helpers, small refactoring