Updated identity session stuff with cleanup and fixes