Improved session handling.