     (unless (= i smex-command-count)
       (setq smex-command-count i))))
 
-(defun smex-auto-update (&optional idle-time)
-  "Update Smex when Emacs has been idle for IDLE-TIME."
-  (unless idle-time (setq idle-time 60))
-  (run-with-idle-timer idle-time t
-                       '(lambda () (if (smex-detect-new-commands) (smex-update)))))
+(defun smex-background-update ()
+  "Update Smex when Emacs has been idle for 20 seconds."
+  (run-with-idle-timer 20 t
+                       '(lambda () (when (smex-detect-new-commands)
+                                     (smex-update-command-keybindings)
+                                     (smex-update)))))
 
 ;;;###autoload
 (defun smex-initialize ()

  (smex-detect-new-commands)
  (smex-rebuild-cache)
  (add-hook 'kill-emacs-hook 'smex-save-to-file)
  (setq smex-initialized-p t))

(defun smex-initialize-ido ()

  (setq smex-ido-cache (smex-convert-for-ido smex-cache)))

(defun smex-convert-for-ido (command-items)
  (mapcar (lambda (command-item)
            (let* ((command (car command-item))
                   (command-name (symbol-name command))
                   (keybinding
                    (gethash command smex-command-keybindings)))
              (if keybinding
                  (format "%s (%s)" command-name keybinding)
                command-name)))
          command-items))

(defun smex-restore-history ()
  "Rearranges `smex-cache' according to `smex-history'"
