Added reconnect logic