 import Foundation
 import Shared
+import Alamofire
+
 private let _singleton = AdBlocker()
 
 class AdBlocker {
     static let prefKeyAdBlockOn = "braveBlockAds"
     static let prefKeyAdBlockOnDefaultValue = true
-    static let dataVersion = "0.3.1"
-    let dataUrl = NSURL(string: "http://brave.github.io/adblock-data/\(dataVersion)/ABPFilterParserData.dat")!
+    static let dataVersion = "1"
+    let dataUrl = NSURL(string: "https://s3.amazonaws.com/adblock-data/\(dataVersion)/ABPFilterParserData.dat")!
     let dataFile = "abp-data-\(dataVersion).dat"
 
     // Store the last 500 URLs checked

        }
    }

    func writeData(data: NSData) {
        let (dir, wasCreated) = dataDir()
        // If dir existed already, clear out the old one
        if !wasCreated {

            task.resume()
        }

        let data = readData()
        if data != nil {
            AdBlockCppFilter.singleton().setAdblockDataFile(data)
            delay(5.0) { // a few seconds after startup, check to see if a new file is available
                Alamofire.request(.HEAD, self.dataUrl).response {
                    request, response, data, error in
                    if let err = error {
                        print("\(err.localizedDescription)")
                    } else {
                        guard let etag = response?.allHeaderFields["Etag"] as? String else { return }
                        let etagOnDisk = self.readDataEtag()
                        if etagOnDisk != etag {
                            networkRequest(forceDownload: true)
                        }
                    }
                }
            }
            return
        }

        networkRequest(forceDownload: false)
    }

    func updateEnabledState() {
