Reconnection logic