added auto reconnect capability