 final class SchemeHandler: NSObject {
     @objc let scheme: String
     private let session: Session
-    private var tasks: [URLRequest: URLSessionTask] = [:]
-    private var queue: DispatchQueue = DispatchQueue(label: "SchemeHandlerQueue", qos: .default, attributes: [.concurrent], autoreleaseFrequency: .workItem, target: nil)
+    private var activeSessionTasks: [URLRequest: URLSessionTask] = [:]
+    private var activeSchemeTasks = NSMutableSet(array: [])
     
     private let cache: SchemeHandlerCache
     private let fileHandler: FileHandler

    }
    
    func webView(_ webView: WKWebView, stop urlSchemeTask: WKURLSchemeTask) {
        queue.async(flags: .barrier) {
            guard let task = self.tasks[urlSchemeTask.request] else {
                return
            }
            if task.state == .running {
                task.cancel()
            }
            self.tasks.removeValue(forKey: urlSchemeTask.request)
        }
    }
}


        case ArticleSectionHandler.basePath:
            articleSectionHandler.handle(pathComponents: pathComponents, requestURL: requestURL, completion: localCompletionBlock)
        case APIHandler.basePath:
            guard self.schemeTaskIsActive(urlSchemeTask: urlSchemeTask) else {
                return
            }
            
            guard let apiURL = apiHandler.urlForPathComponents(pathComponents, requestURL: requestURL) else {
                urlSchemeTask.didFailWithError(SchemeHandlerError.invalidParameters)
                activeSchemeTasks.remove(urlSchemeTask)
                return
            }
            
