added the handling of logged shops, better session management