        (start  (car bounds))
        (end    (cdr bounds))
        (prefix (merlin--buffer-substring start end)))
-    (merlin--kill-overlapping-errors start end)
     (when (or (not merlin-completion-at-point-cache-query)
               (not (equal (cons prefix start)  merlin-completion-at-point-cache-query)))
       (setq merlin-completion-at-point-cache-query (cons prefix start))
       (merlin-sync-to-point (point-max) t)
       (setq merlin-completion-annotation-table
             (mapcar (lambda (a) (cons (car a) (concat ": " (cadr a))))
-                    (merlin-completion-data prefix))))
-    (list start end #'merlin-completion-table
-          . (:exit-function #'merlin-completion-lookup
-             :annotation-function #'merlin-completion-annotate))))
-
-(defun merlin-completion-annotate (candidate)
-  "Retrieve the annotation for candidate CANDIDATE in `merlin-completion-annotate-table'."
-  (cdr (assoc candidate merlin-completion-annotation-table)))
-
-(defun merlin-completion-table (string pred action)
-  "Implement completion for merlin using `completion-at-point' API."
-  (if (eq 'metadata action)
-      (when merlin-completion-types
-        '(metadata ((annotation-function . merlin-completion-annotate)
-                    (exit-function . merlin-completion-lookup))))
-    (complete-with-action action merlin-completion-annotation-table string pred)))
-
+                    (merlin--completion-data prefix))))
+    (list start end #'merlin--completion-table
+          . (:exit-function #'merlin--completion-lookup
+             :annotation-function #'merlin--completion-annotate))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; COMPANY MODE SUPPORT ;;;

          (candidates
           (merlin-sync-to-point)
           (mapcar #'(lambda (x) (propertize (car x) 'merlin-meta (cadr x)))
                   (merlin-completion-data arg)))
          (post-completion
            (let ((minibuffer-message-timeout nil))
              (minibuffer-message "%s : %s" arg (get-text-property 0 'merlin-meta arg))))

  (merlin--acquire-buffer)
  (merlin-send-command 'refresh)
  (merlin-after-save))

(defun merlin-parse-position (result)
  "Returns a pair whose first member is a point set at merlin cursor position
