       (pop-to-buffer buf))))
 
 
-(defun evernote-create-note-buffer (guid name edit-mode tags content)
+(defun evernote-create-note-buffer (guid name tags edit-mode content)
   "Create new buffer for the note"
   (save-excursion
     (let ((buf (generate-new-buffer name)))
       (set-buffer buf)
       (insert content)
-      (setq evernote-note-guid guid
-            evernote-note-name name
-            evernote-note-edit-mode edit-mode
-            evernote-note-tags tags)
-      (evernote-mode)
+      (evernote-change-major-mode-from-note-name name)
+      (evernote-mode guid name tags edit-mode)
       (goto-char (point-min))
-      (evernote-update-mode-line)
       (set-buffer-modified-p nil)
       (pop-to-buffer buf))))
 

;;

(defun evernote-mode-after-save-hook ()
  (setq evernote-mode nil
        evernote-note-guid nil
        evernote-note-name nil
        evernote-note-tags nil
        evernote-note-edit-mode nil
        vc-mode nil)
  (remove-hook 'after-save-hook 'evernote-mode-after-save-hook))


(defun evernote-mode ()
  "Toggle Evernote mode, a minor mode for using evernote functions."
  (interactive)
  (or (assq 'evernote-mode minor-mode-alist)

                                     name
                                     tags
                                     edit-mode)
       (evernote-change-major-mode-from-note-name name)
       (setq evernote-note-guid (evernote-eval-command-result)
             evernote-note-name name
             evernote-note-tags tags
