Attempt at auto-reconnect that does not work well