     (define-key map [?p] 'previous-line)
     (define-key map [?r] 'ledger-auto-reconcile)
     (define-key map [?s] 'ledger-reconcile-save)
-    (define-key map [?q]
-      (function
-       (lambda ()
-	 (interactive)
-	 (kill-buffer (current-buffer)))))
+    (define-key map [?q] 'ledger-reconcile-quit)
     (use-local-map map)))
 
 ;; A sample function for $ users

  (set-buffer-modified-p nil)
  (ledger-display-balance))

(defun ledger-reconcile-finish ()
  (interactive)
  (save-excursion

	 (ledger-buf (current-buffer))
	 exit-code)
    (if (string-match "\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]+\\)" date)
	(setq date
	      (encode-time 0 0 0 (string-to-number (match-string 3 date))
			   (string-to-number (match-string 2 date))
			   (string-to-number (match-string 1 date)))))
    (ledger-find-slot date)
    (save-excursion
      (if (re-search-backward "^Y " nil t)
