improving Reconnection logic