better session handling/slow connection code