Changed code to allow multiple sessions.