Changed how the UndoManager is implemented.