user session refactoring