Move session ifrastructure to SessionSingleton which is better for synchronizing.