Added auto-reconnecting and crash handling stuff