diff --git a/python/spellcheck.py b/python/spellcheck.py
index b2589a24ca5c3b26b2fdcdd6e39d9b3b86f29f95..492afedbf27853e75f12da6b5a9440ae1d31c128 100644
--- a/python/spellcheck.py
+++ b/python/spellcheck.py
@@ -46,10 +46,32 @@ def _clean_text(text):
     text = re.sub(r"\b[a-zA-Z]{1,2}\b", " ", text)
     return text
 
+# return the user whitelist sorted and deduplicated
+def _clean_whitelist_text(whitelist_text):
+    # prepare a checker
+    checker = SpellChecker()
+
+    # add MP keywords and metasymbols
+    checker.word_frequency.load_words("|".split(MP_KEYWORDS))
+    checker.word_frequency.load_words("|".split(MP_META_SYMBOLS))
+
+    # add resource whitelist
+    f = QFile(":/spellcheck_whitelist")
+    f.open(QIODevice.ReadOnly | QIODevice.Text)
+    checker.word_frequency.load_text(QTextStream(f).readAll())
+
+    deduplicated_words = list(checker.unknown(whitelist_text.split()))
+    deduplicated_words.sort(key=str.lower)
+    return ' '.join(deduplicated_words)
+
 # set the whitelist text and the checker
 def _set_checker(whitelist_text):
+    # clean the input so it contains valid words
     whitelist_text = _clean_text(whitelist_text)
 
+    # clean the whitelist so it contains relevant sorted deduplicated words
+    whitelist_text = _clean_whitelist_text(whitelist_text)
+
     # set whitelist text
     _SPELLCHECK_DICT["whitelist_text"] = whitelist_text
 
@@ -106,22 +128,4 @@ def candidate_words(unknown_word):
         candidates = set()
     return sorted(candidates)
 
-# returns the user whitelist sorted and deduplicated
-def cleaned_user_whitelist():
-    # prepare a checker
-    checker = SpellChecker()
-
-    # add MP keywords and metasymbols
-    checker.word_frequency.load_words("|".split(MP_KEYWORDS))
-    checker.word_frequency.load_words("|".split(MP_META_SYMBOLS))
-
-    # add resource whitelist
-    f = QFile(":/spellcheck_whitelist")
-    f.open(QIODevice.ReadOnly | QIODevice.Text)
-    checker.word_frequency.load_text(QTextStream(f).readAll())
-
-    deduplicated_words = list(checker.unknown(user_whitelist().split()))
-    deduplicated_words.sort(key=str.lower)
-    return ' '.join(deduplicated_words)
-
 
diff --git a/python/spellcheck_whitelist_dialog.py b/python/spellcheck_whitelist_dialog.py
index 336c62e906effac9a0ca4e926d9f130bb8377ebd..c63a0f6f6f110036534e4211f56c0da65eb6de4c 100644
--- a/python/spellcheck_whitelist_dialog.py
+++ b/python/spellcheck_whitelist_dialog.py
@@ -25,16 +25,13 @@ class Ui_SpellcheckWhitelistDialog(object):
         SpellcheckWhitelistDialog.resize(572, 320)
         self.close_pb = QPushButton(SpellcheckWhitelistDialog)
         self.close_pb.setObjectName(u"close_pb")
-        self.close_pb.setGeometry(QRect(310, 290, 83, 25))
+        self.close_pb.setGeometry(QRect(240, 290, 83, 25))
         self.verticalLayoutWidget = QWidget(SpellcheckWhitelistDialog)
         self.verticalLayoutWidget.setObjectName(u"verticalLayoutWidget")
         self.verticalLayoutWidget.setGeometry(QRect(0, 0, 571, 281))
         self.layout = QVBoxLayout(self.verticalLayoutWidget)
         self.layout.setObjectName(u"layout")
         self.layout.setContentsMargins(0, 0, 0, 0)
-        self.clean_pb = QPushButton(SpellcheckWhitelistDialog)
-        self.clean_pb.setObjectName(u"clean_pb")
-        self.clean_pb.setGeometry(QRect(180, 290, 81, 25))
 
         self.retranslateUi(SpellcheckWhitelistDialog)
 
@@ -44,6 +41,5 @@ class Ui_SpellcheckWhitelistDialog(object):
     def retranslateUi(self, SpellcheckWhitelistDialog):
         SpellcheckWhitelistDialog.setWindowTitle(QCoreApplication.translate("SpellcheckWhitelistDialog", u"MP Code Whitelist", None))
         self.close_pb.setText(QCoreApplication.translate("SpellcheckWhitelistDialog", u"Close", None))
-        self.clean_pb.setText(QCoreApplication.translate("SpellcheckWhitelistDialog", u"Sort", None))
     # retranslateUi
 
diff --git a/python/spellcheck_whitelist_dialog.ui b/python/spellcheck_whitelist_dialog.ui
index 88e31f9a044622671286736032d4b109a84378e0..804d9a4999d12cbe9b0fc8ab0263759ca8561365 100644
--- a/python/spellcheck_whitelist_dialog.ui
+++ b/python/spellcheck_whitelist_dialog.ui
@@ -16,7 +16,7 @@
   <widget class="QPushButton" name="close_pb">
    <property name="geometry">
     <rect>
-     <x>310</x>
+     <x>240</x>
      <y>290</y>
      <width>83</width>
      <height>25</height>
@@ -37,19 +37,6 @@
    </property>
    <layout class="QVBoxLayout" name="layout"/>
   </widget>
-  <widget class="QPushButton" name="clean_pb">
-   <property name="geometry">
-    <rect>
-     <x>180</x>
-     <y>290</y>
-     <width>81</width>
-     <height>25</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>Sort</string>
-   </property>
-  </widget>
  </widget>
  <resources/>
  <connections/>
diff --git a/python/spellcheck_whitelist_dialog_wrapper.py b/python/spellcheck_whitelist_dialog_wrapper.py
index fd9bfb2345c86967b9ad95c57b92cb4bdb6d7316..dd8e5706d1cdc349dbb9f07af6c169ca366aaade 100644
--- a/python/spellcheck_whitelist_dialog_wrapper.py
+++ b/python/spellcheck_whitelist_dialog_wrapper.py
@@ -4,8 +4,7 @@ from PySide6.QtCore import Signal, Slot # for signal/slot support
 from PySide6.QtWidgets import QDialog, QPlainTextEdit
 from PySide6.QtGui import QKeyEvent, QFocusEvent, QAction
 from spellcheck_whitelist_dialog import Ui_SpellcheckWhitelistDialog
-from spellcheck import user_whitelist, set_checker, user_whitelist, \
-                       cleaned_user_whitelist
+from spellcheck import user_whitelist
 from verbose import verbose
 
 class SpellcheckWhitelistTextEdit(QPlainTextEdit):
@@ -68,7 +67,6 @@ class SpellcheckWhitelistDialogWrapper(QDialog):
                                                           self.show)
 
         # connect
-        self.ui.clean_pb.clicked.connect(self._clean_text)
         self.ui.close_pb.clicked.connect(self.close) # superclass close
         self.whitelist_text_edit.signal_refresh_whitelist.connect(
                                               self._accept_text_changed)
@@ -86,8 +84,3 @@ class SpellcheckWhitelistDialogWrapper(QDialog):
             # replace text in whitelist text edit view
             self.whitelist_text_edit.setPlainText(user_whitelist())
 
-    @Slot()
-    def _clean_text(self):
-        text = cleaned_user_whitelist()
-        self.spellcheck_whitelist_manager.set_user_whitelist(text)
-