diff --git a/firefox/content.js b/firefox/content.js
index ecbb37e3ad7ca84c6175c3235cc5a8ae0567982a..b462aa307956c6d8a15ab3911c9651352ad34e14 100644
--- a/firefox/content.js
+++ b/firefox/content.js
@@ -31,6 +31,5 @@ function addLinkPopup(link) {
     link.addEventListener('mouseleave', scheduleHidePopup, {passive: true});
 }
 
-
-fixAllTheLinks();
+mutationHandler();
 enableMutationObserver();
diff --git a/firefox/mutation.js b/firefox/mutation.js
index 781085a2ba3c4ed8c940b6776df2ee1a78a1869d..96e231a37cec5d0b861d7f6012cd2cc1ffd96c2d 100644
--- a/firefox/mutation.js
+++ b/firefox/mutation.js
@@ -25,30 +25,42 @@
 let mutationObserver = null;
 
 
+/**
+ * Handle mutation events. Attempts to detect a composition pane and
+ * remove nasty links from it.
+ */
+function mutationHandler(mutationsList, observer) {
+    let contentNode = (document.getElementById('divRplyFwdMsg')
+		       || document.getElementById('x_divRplyFwdMsg'))?.nextElementSibling;
+
+    while (contentNode) {
+	removeAllTheLinks(contentNode);
+	contentNode = contentNode.nextElementSibling;
+    }
+    fixAllTheLinks(document.body);
+}
+
+
 /**
  * Enable the mutation observer, creating it is necessary.
  */
 function enableMutationObserver() {
-    console.log('enter enableMutationObserver');
     if (!mutationObserver) {
-	mutationObserver = new MutationObserver(withoutMutationObserver(fixAllTheLinks));
+	mutationObserver = new MutationObserver(withoutMutationObserver(mutationHandler));
     }
     mutationObserver.observe(document.body, {
 	childList: true,
 	subtree: true
     });
-    console.log('exit enableMutationObserver');
 }
 
 /**
  * Disable the mutation observer if it is enabled
  */
 function disableMutationObserver() {
-    console.log('enter disableMutationObserver');
     if (mutationObserver) {
 	mutationObserver.disconnect();
     }
-    console.log('exit disableMutationObserver');
 }
 
 /**
diff --git a/shared/links.js b/shared/links.js
index b277fd433432a6a57e5e935ca52062403c0f38df..41a05723cff66e6410c5981ec1a2802826794a69 100644
--- a/shared/links.js
+++ b/shared/links.js
@@ -56,7 +56,6 @@ function untangleLink(link) {
 		return decodeURIComponent(url);
 	    }
 	    catch (e) {
-		console.log(e);
 		return url;
 	    }
 	});
@@ -101,17 +100,36 @@ function getTextNodes(elem) {
 
 /**
  * Fix all the links in the document.
+ * @param {Element} root - DOM element in which to fix links.
  */
-function fixAllTheLinks() {
-    for (const link of document.links) {
-	// Untangle link text
-	for (const node of getTextNodes(link)) {
-	    node.textContent = untangleLink(node.textContent);
+function fixAllTheLinks(root) {
+    for (const link of root.getElementsByTagName('a')) {
+	if (link.href) {
+	    // Untangle link text
+	    for (const node of getTextNodes(link)) {
+		node.textContent = untangleLink(node.textContent);
+	    }
+
+	    // Create popup event handlers
+	    if (isTangledLink(link.href)) {
+		addLinkPopup(link);
+	    }
 	}
+    }
+}
 
-	// Create popup event handlers
+
+/**
+ * Remove all safe links in an element
+ * @param {Element} root - DOM element in which to fix links.
+ */
+function removeAllTheLinks(root) {
+    for (const link of root.getElementsByTagName('a')) {
 	if (isTangledLink(link.href)) {
-	    addLinkPopup(link);
+	    link.href = untangleLink(link.href);
 	}
     }
+    for (const textNode of getTextNodes(root)) {
+	textNode.textContent = untangleLink(textNode.textContent);
+    }
 }
diff --git a/thunderbird/compose.js b/thunderbird/compose.js
index f9a8c15d9e9af9ae070b61e0240f7cee037d7d2d..bf7a1c9e47320edb046585fc2b866721fe365b3a 100644
--- a/thunderbird/compose.js
+++ b/thunderbird/compose.js
@@ -22,13 +22,4 @@
 // Compose script
 
 
-for (const link of document.links) {
-    if (isTangledLink(link.href)) {
-	link.href = untangleLink(link.href);
-    }
-}
-
-for (const node of getTextNodes(document)) {
-    node.textContent = untangleLink(node.textContent);
-}
-
+removeAllTheLinks(document.body);
diff --git a/thunderbird/display.js b/thunderbird/display.js
index 813f6b8af66c27b3c485a46bdc08e559c8f48b55..292ba3b85ac875fdfed10a6678c80b371f4539c9 100644
--- a/thunderbird/display.js
+++ b/thunderbird/display.js
@@ -31,5 +31,4 @@ function addLinkPopup(link) {
     link.addEventListener('mouseleave', scheduleHidePopup, {passive: true});
 }
 
-
-fixAllTheLinks();
+fixAllTheLinks(document.body);