diff --git a/configure.in b/configure.in
index 6f8c1b5..a3dc434 100644
--- a/configure.in
+++ b/configure.in
@@ -26,11 +26,6 @@ AC_PROG_INSTALL
 dnl Check for various modules. NOTE: On OpenSolaris, you may
 dnl need to set PKG_CONFIG_PATH=/usr/lib/pkgconfig in order
 dnl for these to be found.
-PKG_CHECK_MODULES(orca, \
-	dbus-python >= 0.83.0 \
-	gnome-python-desktop-2.0 >= 2.24.0 \
-	libspi-1.0 >= 1.24.0 \
-)
 
 dnl Check for python and python modules needed by Orca
 dnl TODO: check for incompatibilities between Orca and liblouis
diff --git a/src/orca/orca.py b/src/orca/orca.py
index e69c357..923f3f7 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -57,6 +57,7 @@ except RuntimeError:
 
 import getopt
 import os
+import re
 import signal
 import time
 import unicodedata
@@ -1067,12 +1068,34 @@ def loadUserSettings(script=None, inputEvent=None):
     # For now, we'll just look at the Orca modifier keys we support
     # (Caps Lock, KP_Insert, and Insert).]]]
     #
+    clearedMods = {}
+    removeCmd = ""
     for keyName in settings.orcaModifierKeys:
-        if keyName == "Caps_Lock":
-            os.system('xmodmap -e "clear Lock"')
+        if keyName in orca_state.xmodmapMods:
+            removeCmd += "remove " + orca_state.xmodmapMods[keyName] + \
+                " = " + keyName + "\n"
+            orca_state.clearedXmodmapMods[keyName] = True
+            clearedMods[keyName] = True
+
         if keyName in ["Caps_Lock", "KP_Insert", "Insert"]:
-            command = 'xmodmap -e "keysym %s = %s"' % (keyName, keyName)
-            os.system(command)
+            removeCmd += "keysym %s = %s" % (keyName, keyName)
+
+    removeCmd = "echo -e \"" + removeCmd + "\" | xmodmap -"
+    os.system(removeCmd)
+
+    # Some keys were previously in orcamod keys,
+    # and were originally modifiers,
+    # we have reloaded and they arent any longer there.
+    # so re-enable their original functionality.
+    #
+    addCmd = ""
+    for i in orca_state.clearedXmodmapMods:
+        if orca_state.clearedXmodmapMods[i] and i not in clearedMods:
+            addCmd = "add " + orca_state.xmodmapMods[i] + " = " + i + "\n"
+            orca_state.clearedXmodmapMods[i] = False
+    if addCmd:
+        addCmd = "echo -e \"" + addCmd + "\" | xmodmap -"
+        os.system(addCmd)
 
     if _currentPresentationManager >= 0:
         _PRESENTATION_MANAGERS[_currentPresentationManager].activate()
@@ -1302,6 +1325,19 @@ def start(registry):
 
 def die(exitCode=1):
 
+    # Restore any xmodmap modifiers that we might have changed.
+    #
+    addCmd = ""
+    # We know what we are doing,
+    # disable warning about i being possibly undefined.
+    # pylint: disable-msg=W0631
+
+    for i in orca_state.xmodmapMods:
+        addCmd = "add " + orca_state.xmodmapMods[i] + " = " + i + "\n"
+
+    addCmd = "add " + orca_state.xmodmapMods[i] + " = " + i + "\n"
+    os.system(addCmd)
+
     # We know what we are doing here, so tell pylint not to flag
     # the _exit method call as a warning.  The disable-msg is
     # localized to just this method.
@@ -1365,6 +1401,21 @@ def shutdown(script=None, inputEvent=None):
         signal.alarm(0)
 
     _initialized = False
+
+    # Restore any xmodmap modifiers that we might have changed.
+    #
+    addCmd = ""
+
+    # We know what we are doing, so disable pylint warning
+    # about i being possibly undefined.
+    # pylint: disable-msg=W0631
+
+    for i in orca_state.xmodmapMods:
+        addCmd = "add " + orca_state.xmodmapMods[i] + " = " + i + "\n"
+
+    addCmd = "add " + orca_state.xmodmapMods[i] + " = " + i + "\n"
+    os.system(addCmd)
+
     return True
 
 exitCount = 0
@@ -1683,6 +1734,9 @@ def main():
         print "environment variable has been set."
         return 1
 
+    # Save the current xmodmap modifiers before we change anything.
+    saveXmodmapMods()
+
     userprefs = settings.userPrefsDir
     sys.path.insert(0, userprefs)
     sys.path.insert(0, '') # current directory
@@ -1713,5 +1767,22 @@ def main():
     start(pyatspi.Registry) # waits until we stop the registry
     return 0
 
+
+def saveXmodmapMods():
+    cmd = "xmodmap | tail -n 9 | head -n 8 | sed " + \
+    "-e 's/([^)]*)//g' -e 's/,//g'"
+    filehandle = os.popen(cmd)
+    txt = filehandle.read()
+    filehandle.close()
+    lines = txt.splitlines()
+    for i in range(0, len(lines)):
+        lines[i] = re.sub('\ +', ' ', lines[i])
+        lines[i] = re.sub('\ +$', '', lines[i])
+        lst = lines[i].split(" ")
+        tag = lst[0]
+        for i in lst[1:]:
+            orca_state.xmodmapMods[i] = tag
+    return
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/src/orca/orca_state.py b/src/orca/orca_state.py
index ab4d68f..08f4137 100644
--- a/src/orca/orca_state.py
+++ b/src/orca/orca_state.py
@@ -134,3 +134,15 @@ mouseEnhancementsEnabled = True
 # The current zoomer type.
 #
 zoomerType = None
+
+# The state of the xmodmap modifiers before
+# orca modifier keys are allowed to effect the system.
+# Note this variable should be read-only, only written to
+# from orca.saveXmodmapMods()
+#
+xmodmapMods = {}
+
+# A hash of keys, from xmodmapMods that had to be cleared
+# when the orca modifier keys were set.
+#
+clearedXmodmapMods = {}
