             self.reloadBlockers(lists)
         }
     }
-
-    private func setupUserScripts() {
-        browserView.configuration.userContentController.add(self, name: "focusTrackingProtection")
-        let source = try! String(contentsOf: Bundle.main.url(forResource: "preload", withExtension: "js")!)
-        let script = WKUserScript(source: source, injectionTime: .atDocumentStart, forMainFrameOnly: true)
+    
+    private func addScript(forResource resource: String, injectionTime: WKUserScriptInjectionTime, forMainFrameOnly mainFrameOnly: Bool) {
+        let source = try! String(contentsOf: Bundle.main.url(forResource: resource, withExtension: "js")!)
+        let script = WKUserScript(source: source, injectionTime: injectionTime, forMainFrameOnly: mainFrameOnly)
         browserView.configuration.userContentController.addUserScript(script)
-
-        browserView.configuration.userContentController.add(self, name: "focusTrackingProtectionPostLoad")
-        let source2 = try! String(contentsOf: Bundle.main.url(forResource: "postload", withExtension: "js")!)
-        let script2 = WKUserScript(source: source2, injectionTime: .atDocumentEnd, forMainFrameOnly: false)
-        browserView.configuration.userContentController.addUserScript(script2)
-        
-        browserView.configuration.userContentController.add(self, name: "findInPageHandler")
-        let source3 = try! String(contentsOf: Bundle.main.url(forResource: "FindInPage", withExtension: "js")!)
-        let script3 = WKUserScript(source: source3, injectionTime: .atDocumentEnd, forMainFrameOnly: true)
-        browserView.configuration.userContentController.addUserScript(script3)
+    }
+
+    private func setupTrackingProtectionScripts() {
+        browserView.configuration.userContentController.add(self, name: ScriptHandlers.focusTrackingProtection.rawValue)
+        addScript(forResource: "preload", injectionTime: .atDocumentStart, forMainFrameOnly: true)
+        browserView.configuration.userContentController.add(self, name: ScriptHandlers.focusTrackingProtectionPostLoad.rawValue)
+        addScript(forResource: "postload", injectionTime: .atDocumentEnd, forMainFrameOnly: false)
+    }
+    
+    private func setupFindInPageScripts() {
+        browserView.configuration.userContentController.add(self, name: ScriptHandlers.findInPageHandler.rawValue)
+        addScript(forResource: "FindInPage", injectionTime: .atDocumentEnd, forMainFrameOnly: true)
     }
 
     func disableTrackingProtection() {
         guard case .on = trackingProtectionStatus else { return }
-
-        browserView.configuration.userContentController.removeScriptMessageHandler(forName: "focusTrackingProtection")
-        browserView.configuration.userContentController.removeScriptMessageHandler(forName: "focusTrackingProtectionPostLoad")
+        ScriptHandlers.allValues.forEach {
+            browserView.configuration.userContentController.removeScriptMessageHandler(forName: $0.rawValue)
+        }
         browserView.configuration.userContentController.removeAllUserScripts()
         browserView.configuration.userContentController.removeAllContentRuleLists()
+        setupFindInPageScripts()
         trackingProtectionStatus = .off
     }
 

}

class WebViewController: UIViewController, WebController {
    weak var delegate: WebControllerDelegate?

    private var browserView = WKWebView()

        guard case .off = trackingProtectionStatus else { return }

        setupBlockLists()
        setupTrackingProtectionScripts()
        trackingProtectionStatus = .on(TPPageStats())
    }
    
