Added watchdog thread to reconnect if connection dies