Refactored the SessionManager