Improved session helper a bit.