Refactored Session Handling