Improve session management