     (erl-spawn
       (erl-send-rpc node 'wrangler_distel 'move_fun
 		    (list current-file-name line-no column-no name create-new-file erlang-refac-search-paths))
-      (erl-receive (buffer)
+      (erl-receive (buffer line-no column-no)
 	  ((['rex ['badrpc rsn]]
 	    (message "Refactoring failed: %S" rsn))
 	   (['rex ['error rsn]]
 	    (message "Refactoring failed: %s" rsn))
 	   (['rex ['ok modified]]
+	    (dolist (f modified)
+ 	      (let ((buff (get-file-buffer f)))
+ 		(if buff
+ 		    (with-current-buffer buff (revert-buffer nil t t))
+ 		  ;;(message-box (format "modified unopened file: %s" f))))))
+ 		  nil)))
 	    (with-current-buffer buffer
-	       (dolist (f modified)
-		 (let ((buffer (get-file-buffer f)))
-		   (if buffer (with-current-buffer buffer (revert-buffer nil t t))
-		     ;;(message-box (format "modified unopened file: %s" f))))))
-		     nil))))
-	       (message "Refactoring succeeded!")))))))))
+	      (goto-char (get-position line-no column-no)))
+	    (message "Refactoring succeeded!")))))))))
 
 (defun create-new-file-p (filename erlang-refac-search-paths)
   (if (equal (locate-file (concat filename ".erl") erlang-refac-search-paths) nil)

  (save-excursion
    (goto-line line)
    (move-to-column col)
    (point)))


(defvar highlight-region-overlay

	(erl-spawn
	  (erl-send-rpc node 'wrangler_distel 'fun_extraction
			(list current-file-name start-line-no start-col-no end-line-no (- end-col-no 1) name))
	  (erl-receive (buffer start-line-no start-col-no)
	      ((['rex ['badrpc rsn]]
		(message "Refactoring failed: %S" rsn))
	       (['rex ['error rsn]]
		(message "Refactoring failed: %s" rsn))
	       (['rex ['ok refac_fun_extraction]]
		(with-current-buffer buffer (progn (revert-buffer nil t t)
							   (goto-char (get-position start-line-no start-col-no))))
		(message "Refactoring succeeded!")))))))))

(defun erl-refactor-new-macro(node name start end)
