         self.tableView.endUpdates()
     }
 
+    func setTableViewEditing(editing: Bool, animated: Bool) {
+        if editing {
+            self.navigationItem.leftBarButtonItem = self.doneButton
+        } else {
+            self.navigationItem.leftBarButtonItem = self.editButton
+        }
+        self.tableView.setEditing(editing, animated: animated)
+    }
+
 
     // MARK: - Navigation Item
 
+    func updateEditButtonHidden() {
+        if self.cards.count == 0 {
+            self.navigationItem.leftBarButtonItem = nil
+        } else if self.tableView.editing {
+            self.navigationItem.leftBarButtonItem = self.doneButton
+        } else {
+            self.navigationItem.leftBarButtonItem = self.editButton
+        }
+    }
+
     func editButtonDidPress() {
         let editing = self.tableView.editing
-        if editing {
-            self.navigationItem.leftBarButtonItem = self.editButton
-        } else {
-            self.navigationItem.leftBarButtonItem = self.doneButton
-        }
-        self.tableView.setEditing(!editing, animated: true)
+        self.setTableViewEditing(!editing, animated: true)
     }
 
     func addButtonDidPress() {

        } else {
            let editorView = CardEditorViewController(card: card)
            let navigationController = UINavigationController(rootViewController: editorView)
            self.presentViewController(navigationController, animated: true, completion: self.editButtonDidPress)
        }
    }


        NSNotificationCenter.defaultCenter().removeObserver(self)
    }

    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        self.updateEditButtonHidden()
        if self.tableView.editing {
            self.setTableViewEditing(false, animated: false)
        }
    }


    // MARK: - UITableView

