         {
             self.window.undoManager.setActionName("Insert Box")
         }
-        currentDocument.boxes.insert(box, atIndex: index)
+        boxes.insert(box, atIndex: index)
     }
 
     func removeBox(index: Int)

            
            tableArrayController.addObserver(self, forKeyPath: "selection", options: nil, context: nil)
            observing = true
//            tableArrayController.setSelectionIndex(1)
//            tableArrayController.setSelectionIndex(0) // Move the selection so the observer sees the change and updates the display
            currentDocument.createPageIndex()
//            tableView.scrollRowToVisible(0)
//            tableView.becomeFirstResponder()
        }

    }

        newBox.x2 = box.x2
        box.x2 = newBox.x - 2

        boxes.insert(newBox, atIndex: index + 1)

        currentDocument.createPageIndex()
        updateSelectedCharacterDisplays()
