     @IBAction func clickCard(sender: NSTableView) {
         guard sender.clickedRow >= 0 else { return }
         let card = currentDeck!.sortedCards[sender.clickedRow]
-        currentDeck!.removeCard(card)
-
-        isSaved = false
-
-        deckCardsView.reloadData()
-        cardsCollectionView.reloadData()
-        curveView.reload()
+        
+        undoCardAdd(card)
     }
 
     func addCardToDeck(card: Card) {


            if isCmd {
                switch e.keyCode {
                case 6:
                    self.window!.performClose(nil)
                    return nil

                case 3: // cmd-f
                    self.searchField.selectText(self)
                    self.searchField.becomeFirstResponder()

                         name: "theme",
                         object: nil)

        deckUndoManager = window?.undoManager
        initKeyboardShortcuts()
    }

