session move to global
merge with Clyde's code