refactoring and restructuring of web session management