Added loop to reconnect after disconnect