Implemented auto reconnect