              (previous-ranges (gethash key floobits-user-highlights)))
         (floobits-debug-message "%s key %s" key previous-ranges)
         (when previous-ranges
-          ; convert to list :(
-          (mapc
-            (lambda(x)
-              (let ((start (min (buffer-size buffer) (+ (elt x 0) 1)))
-                    (end (+ (elt x 1) 2)))
-                (hlt-unhighlight-region start end)))
-            previous-ranges))
-        (mapc
-          (lambda(x)
-            (let ((start (min (buffer-size buffer) (+ (elt x 0) 1)))
-                  (end (+ (elt x 1) 2)))
-              (hlt-highlight-region start end)))
-          ranges)
+          (floobits-highlight-apply-f 'hlt-unhighlight-region previous-ranges))
+        (floobits-highlight-apply-f 'hlt-highlight-region ranges)
         (puthash key ranges floobits-user-highlights)))))
 
 (defun floobits-event-highlight (req)

  (find-file (floo-get-item req 'full_path))
  (goto-char (+ 1 (floo-get-item req 'offset))))

(defun floobits-apply-highlight (user_id buffer ranges)
  (with-current-buffer buffer
    (save-excursion


    (when should-jump
      (unless (window-minibuffer-p (get-buffer-window))
        (switch-to-buffer buffer)
        (unless (pos-visible-in-window-p pos)
          (condition-case err
            (scroll-up (- (line-number-at-pos pos) (line-number-at-pos)))
            (error)))))))

(defun floobits-event-save (req)
  (let ((buffer (get-file-buffer (floo-get-item req 'full_path))))
