     (eq 0 (compare-buffer-substrings
            (get-buffer vimgolf-work-buffer-name) (point-min-in-buffer vimgolf-work-buffer-name) (point-max-in-buffer vimgolf-work-buffer-name)
            (get-buffer vimgolf-end-buffer-name) (point-min-in-buffer vimgolf-end-buffer-name) (point-max-in-buffer vimgolf-end-buffer-name)))))
-
-(defun vimgolf-close-and-capture-dribble ()
-  (with-current-buffer (find-file-noselect vimgolf-dribble-file-path)
-    (append-to-file (point-min) (point-max) vimgolf-keystrokes-file-path)
-    (kill-buffer))
-  (open-dribble-file nil))
-
-(defun vimgolf-open-dribble-file (file)
-  (if file (open-dribble-file file) (vimgolf-close-and-capture-dribble)))
 
 (defun vimgolf-wrong-solution ()
   (message "Wrong!")

(defun vimgolf-kill-existing-session ()
  (if (get-buffer vimgolf-start-buffer-name) (kill-buffer vimgolf-start-buffer-name))
  (if (get-buffer vimgolf-work-buffer-name) (kill-buffer vimgolf-work-buffer-name))
  (if (get-buffer vimgolf-end-buffer-name) (kill-buffer vimgolf-end-buffer-name)))

;;;###autoload
(defun vimgolf (challenge-id)
  "Open a VimGolf Challenge"
  (interactive "sChallenge ID: ")
  (clear-dribble-file)
  (setq vimgolf-prior-window-configuration (current-window-configuration)
        vimgolf-challenge challenge-id)
  (let ((vimgolf-yaml-buffer (url-retrieve-synchronously (vimgolf-challenge-url challenge-id)))

                              " ")))
    (insert " ")))

(defun vimgolf-capture-keystrokes ()
  (add-hook 'post-command-hook 'vimgolf-capture-keystroke))

(defun vimgolf-stop-capture-keystrokes ()
  (remove-hook 'post-command-hook 'vimgolf-capture-keystroke))

(defun vimgolf-right-solution ()
  (message "Hurray!")
  (let ((keystrokes-count nil))        ; Need to implement keystroke counting. Should be as simple as counting spaces and adding 1.
    (message "You should really write that parser at some point.")))

(defun vimgolf-submit ()
  "Stop the challenge and attempt to submit the solution to VimGolf."
  (interactive)
  (vimgolf-stop-capture-keystrokes)
  (if (vimgolf-solution-correct-p) (vimgolf-right-solution) (vimgolf-wrong-solution)))

(defun vimgolf-clear-keystrokes ()
  (with-current-buffer (get-buffer-create vimgolf-keystrokes-buffer-name)
    (erase-buffer)))

(defun vimgolf-revert ()
  "Revert the work buffer to it's original state and reset keystrokes."
