Sessions refactoring