   (let ((current-file-name (buffer-file-name))
 	(buffer (current-buffer)))	     
     (erl-spawn
-      (erl-send-rpc node 'wrangler_distel 'duplicated_code
-		    (list current-file-name minlines minclones))
+      (erl-send-rpc node 'wrangler_distel 'duplicated_code_in_buffer
+		    (list current-file-name mintokens minclones))
       (erl-receive (buffer)
 	  ((['rex ['badrpc rsn]]
 	    (message "Duplicated code detection failed: %S" rsn))

	    (message "Duplicated code detection finished!")))))))


(defun erl-refactor-duplicated-code-in-directories(node minlines minclones)
  "Find code clones in the current buffer."
  (interactive (list (erl-target-node)
		     (read-string "Minimum number of tokens a code clone should have: ")
		     (read-string "Minimum number of duplicated times: ")

  (let ((current-file-name (buffer-file-name))
	(buffer (current-buffer)))	     
    (erl-spawn
      (erl-send-rpc node 'wrangler_distel 'duplicated_code_in_dirs
		    (list erlang-refac-search-paths mintokens minclones))
      (erl-receive (buffer)
	  ((['rex ['badrpc rsn]]
	    (message "Duplicated code detection failed: %S" rsn))
