Separate the connect logic into private method, add reconnect method and expose it publicly