     (save-excursion (funcall function))
     (forward-line)))
 
-;; TODO implement me
+(defun kotct/packup-marker-regexp ()
+  (concat "^\\[" (regexp-quote (char-to-string kotct/packup-marker-char)) "\\]"))
+
+(defmacro kotct/packup-map-over-marks (body)
+  "Call BODY on each marked line in current buffer."
+  `(prog1
+       (let ((inhibit-read-only t) case-fold-search found results)
+         (let ((regexp (kotct/packup-marker-regexp)) next-position)
+           (save-excursion
+             (goto-char (point-min))
+             ;; remember position of next marked package before BODY
+             ;; can insert lines before the just found package,
+             ;; confusing us by finding the same marked package again
+             ;; and again and...
+             (setq next-position (and (re-search-forward regexp nil t)
+                                      (point-marker))
+                   found (not (null next-position)))
+             (while next-position
+               (goto-char next-position)
+               (setq results (cons ,body results))
+               (message "hi")
+               ;; move after last match
+               (goto-char next-position)
+               (forward-line 1)
+               (set-marker next-position nil)
+               (setq next-position (and (re-search-forward regexp nil t)
+                                        (point-marker))))))
+         (if t
+             results
+           nil))))
+
+(defun kotct/packup-get-package-name ()
+    "Gets package name on current line.
+Returns \"\" if there is no package name on the line."
+    (save-excursion
+      (beginning-of-line)
+      (let (p)
+           (forward-char 4)
+           (setq p (point-marker))
+           (if (re-search-forward " " nil t)
+               (prog2
+                   (backward-char)
+                   (buffer-substring p (point-marker))
+                   )
+             ""))))
+
 (defun kotct/packup-do-update ()
-    ""
-    )
+  "Executes update in current buffer."
+  (interactive)
+  (let ((inhibit-read-only t))
+    (save-excursion
+      (goto-char (point-min))
+      (let ((kotct/dependency-list (kotct/packup-map-over-marks (intern (kotct/packup-get-package-name)))))
+        (kotct/packup-install-dependencies nil t t))))
+  (kotct/packup-refresh))
 
 (defun kotct/packup-mark (arg &optional interactive)
   "Mark the package for update at point in the Packup buffer.

  (let ((kotct/packup-marker-char ?\040))
    (kotct/packup-mark arg interactive)))

;; TODO (un)mark all

(defun kotct/packup-initialize-buffer ()
  "Initializes the packup buffer."

                   (terpri)
                   (princ (symbol-name (car package)))
                   (princ (if (cdr package) " (update)" " (install)"))))
               (if (or auto-update
                       (y-or-n-p "Auto install/update these package?"))
                   (progn (package-download-transaction (package-compute-transaction () install-list))
                          (kill-buffer "*packup: packages to upgrade*")
                          (message "Dependency installation completed."))
