Improved session id generation
Updated to handle upgrades from 1.2.3
Updated with latest changes.