Rework autoreconnect/autojoin code to be less tricky