Implement auto-reconnecting