anchor.diff:        var ipnsUrl = 'http://${settings.host}:${settings.port}/ipns/${url.replace(scheme: '')}';
         if (_domainCache.containsKey(cacheKey) &&
             _domainCache[cacheKey].cacheTime.isAfter(new DateTime.now().subtract(_CACHE_DURATION))) {
  -        if (_domainCache[cacheKey].ipnsRecordExists) {
  +        if (_domainCache[cacheKey].ipnsAvailable) {
             redirectUrl = ipnsUrl;
           }
         } else {
  -        var req = new HttpRequest();
  -        req.open('GET', 'http://${settings.host}:${settings.port}/ipns/${url.host}', async: false);
  -        req.onLoad.listen((event) {
  -          if ((event.target as HttpRequest).status < 400) {
  -            redirectUrl = ipnsUrl;
  -            _domainCache[cacheKey] = new DomainCacheItem(new DateTime.now(), true);
  -          } else {
  -            _domainCache[cacheKey] = new DomainCacheItem(new DateTime.now(), false);
  -          }
  -        });
  -        req.send();
  +        var ipnsAvailable = _requestIpnsAvailability(url.host);
  +        _domainCache[cacheKey] = new DomainCacheItem(new DateTime.now(), ipnsAvailable);
  +        if (ipnsAvailable) {
  +          redirectUrl = ipnsUrl;
  +        }
         }
       }
   
       return redirectUrl;
  +  }
  +
  +  void _initCacheCleaner() {
  +    new Timer.periodic(_CACHE_DURATION * 10, (_) {
  +      var keysToRemove = [];
  +      var oldestCacheTime = new DateTime.now().subtract(_CACHE_DURATION);
  +      _domainCache.forEach((k, v) {
  +      if (v.cacheTime.isBefore(oldestCacheTime)) {
  +          keysToRemove.add(k);
  +        }
  +      });
  +      keysToRemove.forEach((k) => _domainCache.remove(k));
  +    });
  +  }
  +
  +  void _initIpfsRequestUrls() {
  +    var urls = makeIpfsGlobs('file://');
  +    if (_errorMode) {
  +      urls.addAll(makeIpfsGlobs(settings.server));
  +    } else {
  +      urls.addAll(makeIpfsGlobs('http://gateway.ipfs.io'));
  +    }
  +    _ipfsRequestUrls = urls.map((url) => Uri.parse(url)).toList(growable: false);
  +  }
  +
  +  void _initSettingsListener() {
  +    settings.changes.listen((_) {
  +      dartifyChromeEvent(chromeWebRequest, 'onErrorOccurred')
  +          .callMethod('removeListener', [_onErrorAction]);
  +      _setIpfsRequestErrorListener();
  +      _errorMode = false;
  +    });
     }
   
     bool _isIpfsUrl(Uri url) {
  
positive.code:     }
  
      return urlMatch;
    }
  
    void _onErrorAction(JsObject details) {
  
negative.code:     ]);
    }
    
    void _setChromeRequestListener() {
      var urlsToListen = ['http://*/', 'https://*/'];
      urlsToListen.addAll(makeIpfsGlobs('file://'));
  
  