   func visit(page url: Foundation.URL) {
     visitedPages.insert(url)
 
-    let task = URLSession.shared.dataTask(with: url) { [weak self] data, _, _ in
+    currentTask = URLSession.shared.dataTask(with: url) { [weak self] data, _, _ in
       defer { self?.crawl() }
       guard
         let data = data,

    crawl()
  }

  func crawl() {
    guard
      visitedPages.count < maximumPagesToVisit,

    }

    visitingCallback?(url)
    currentTask?.resume()
  }

  func parse(document: String, url: Foundation.URL) {
