Added reconnect logic to lost connection state.