Merging to trunk. Session history is saved (probably needs tweaking) wherever