work for weekend, lots of refactoring and SessionCache management