Improved session handling mechanism