     (json-read)))
 
 (defun vimgolf-setup (status challenge-id)
-  (setq response (read-json challenge-id))
+  (let ((defvar url-http-end-of-headers)
+        (url-mime-encoding-string "identitiy"))
+    (setq response (vimgolf-retrieve-challenge challenge-id)))
 
   (vimgolf-clear-keystrokes)
   (setq vimgolf-prior-window-configuration (current-window-configuration)
         vimgolf-challenge challenge-id)
   (goto-char (point-min))
 
-  (let* ((start-text (get-text 'in response))
-         (end-text   (get-text 'out response)))
+  (let* ((start-text (vimgolf-get-text 'in response))
+         (end-text   (vimgolf-get-text 'out response)))
     (vimgolf-kill-existing-session)
 
     (let ((vimgolf-start-buffer (get-buffer-create vimgolf-start-buffer-name))

    (when (get-buffer buf)
      (kill-buffer buf))))

(defun get-text (var response)
  (format "%s" (assoc-default 'data (assq var response))))

(defun read-json (challenge-id)
  (interactive)
  (with-current-buffer
      (url-retrieve-synchronously (vimgolf-challenge-url challenge-id))

(defvar vimgolf-start-buffer-name "*vimgolf-start*")
(defvar vimgolf-end-buffer-name "*vimgolf-end*")
(defvar vimgolf-keystrokes-buffer-name "*vimgolf-keystrokes*")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Keystroke logging
