     (erl-send-rpc node 'application 'stop (list 'wrangler_app))
     (erl-receive()
 	((['rex 'ok]
-	  (setq erlang-menu-items 
-		(erlang-menu-delete 'refactor-menu-items erlang-menu-items))
-	  (erlang-menu-init)
-	  (message "Wrangler stopped.")
-	  (setq erlang-refactor-status 0))
+	   (remove-wrangler-menu)
+	   (message "Wrangler stopped.")
+	   (setq erlang-refactor-status 0))
 	 (['rex ['error ['not_started app]]]
-	  (setq erlang-menu-items 
-		(erlang-menu-delete 'refactor-menu-items erlang-menu-items))
-	  (erlang-menu-init)
+	  (remove-wrangler-menu)
 	  (message "Wrangler stopped.")
 	  (setq erlang-refactor-status 0))
 	 (['rex ['error rsn]]

    ("\M-?"      erl-complete)	; Some windowmanagers hijack M-TAB..
    ("\C-c\C-de" erl-ie-show-session)
    ("\C-c\C-df" erl-refactor-subfunction)
    ("\C-u"      erl-refactor-undo)   ;; added by Huiqing Li
    ("\C-c\C-dF" erl-find-module)
    ("\C-c\C-dg" erl-ping)
    ("\C-c\C-dh" erl-find-doc-under-point)

    (erl-send-rpc node 'application 'start (list 'wrangler_app))
    (erl-receive()
	((['rex 'ok]
	  (add-wrangler-menu)
	  (message "Wrangler started.")
	   (setq erlang-refactor-status 1))
	 (['rex ['error ['already_started app]]]
	  (add-wrangler-menu)
	  (message "Wrangler started")
	  (setq erlang-refactor-status 1))
	 (['rex ['error rsn]]
