browser session handling refactored