Some bugfixes, some progress on Session (very incomplete.)