       (let ((beg (point)))
 	(insert (format "%s %-30s %8.2f\n"
 			(format-time-string "%Y.%m.%d" (nth 2 item))
-			(nth 3 item)
-			(string-to-number (nth 4 item))))
+			(nth 3 item) (nth 4 item)))
 	(if (nth 1 item)
 	    (set-text-properties beg (1- (point))
 				 (list 'face 'bold
-				       'where (nth 0 item))))))))
+				       'where (nth 0 item)))
+	  (set-text-properties beg (1- (point))
+			       (list 'where (nth 0 item))))))
+    (goto-char (point-min))))
+
+(provide 'ledger)
+
+;;; ledger.el ends here

(defun ledger-add-entry (entry)
  (interactive
   (list (read-string "Entry: "

    (delete-char 5)
    (exchange-point-and-mark)))

(defun ledger-toggle-current ()
  (interactive)
  (let (clear)
    (save-excursion
      (when (or (looking-at "^[0-9]")
		(re-search-backward "^[0-9]" nil t))
	(skip-chars-forward "0-9./")
	(delete-horizontal-space)
	(if (equal ?\* (char-after))
	    (delete-char 1)
	  (insert " * ")
	  (setq clear t))))
    clear))

(define-derived-mode ledger-mode text-mode "Ledger"
  "A mode for editing ledger data files."
