Refactored for explicit session management