diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp
index 4d469fd209..4bb9955e6e 100644
--- a/apps/opencs/view/world/table.cpp
+++ b/apps/opencs/view/world/table.cpp
@@ -2,7 +2,6 @@
 #include "table.hpp"
 
 #include <QHeaderView>
-
 #include <QAction>
 #include <QApplication>
 #include <QMenu>
@@ -10,6 +9,8 @@
 #include <QString>
 #include <QtCore/qnamespace.h>
 
+#include "../../model/doc/document.hpp"
+
 #include "../../model/world/data.hpp"
 #include "../../model/world/commands.hpp"
 #include "../../model/world/idtableproxymodel.hpp"
@@ -47,7 +48,7 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event)
 
                 CSMWorld::UniversalId id = mModel->view (row).first;
 
-                if (!mData.getCells().getRecord (id.getId()).isDeleted())
+                if (!mDocument.getData().getCells().getRecord (id.getId()).isDeleted())
                     menu.addAction (mViewAction);
             }
         }
@@ -175,11 +176,12 @@ std::vector<std::string> CSVWorld::Table::listDeletableSelectedIds() const
     return deletableIds;
 }
 
-CSVWorld::Table::Table (const CSMWorld::UniversalId& id, CSMWorld::Data& data, QUndoStack& undoStack,
-    bool createAndDelete, bool sorting, const CSMDoc::Document& document)
-    : mUndoStack (undoStack), mCreateAction (0), mCloneAction(0), mEditLock (false), mRecordStatusDisplay (0), mDocument(document), mData (data)
+CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
+    bool createAndDelete, bool sorting, CSMDoc::Document& document)
+: mCreateAction (0), mCloneAction(0), mEditLock (false), mRecordStatusDisplay (0),
+  mDocument (document)
 {
-    mModel = &dynamic_cast<CSMWorld::IdTable&> (*data.getTableModel (id));
+    mModel = &dynamic_cast<CSMWorld::IdTable&> (*mDocument.getData().getTableModel (id));
 
     mProxyModel = new CSMWorld::IdTableProxyModel (this);
     mProxyModel->setSourceModel (mModel);
@@ -203,7 +205,7 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id, CSMWorld::Data& data, Q
                 mModel->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt());
 
             CommandDelegate *delegate = CommandDelegateFactoryCollection::get().makeDelegate (display,
-                undoStack, this);
+                mDocument.getUndoStack(), this);
 
             mDelegates.push_back (delegate);
             setItemDelegateForColumn (i, delegate);
@@ -285,13 +287,13 @@ void CSVWorld::Table::revertRecord()
         if (revertableIds.size()>0)
         {
             if (revertableIds.size()>1)
-                mUndoStack.beginMacro (tr ("Revert multiple records"));
+                mDocument.getUndoStack().beginMacro (tr ("Revert multiple records"));
 
             for (std::vector<std::string>::const_iterator iter (revertableIds.begin()); iter!=revertableIds.end(); ++iter)
-                mUndoStack.push (new CSMWorld::RevertCommand (*mModel, *iter));
+                mDocument.getUndoStack().push (new CSMWorld::RevertCommand (*mModel, *iter));
 
             if (revertableIds.size()>1)
-                mUndoStack.endMacro();
+                mDocument.getUndoStack().endMacro();
         }
     }
 }
@@ -305,13 +307,13 @@ void CSVWorld::Table::deleteRecord()
         if (deletableIds.size()>0)
         {
             if (deletableIds.size()>1)
-                mUndoStack.beginMacro (tr ("Delete multiple records"));
+                mDocument.getUndoStack().beginMacro (tr ("Delete multiple records"));
 
             for (std::vector<std::string>::const_iterator iter (deletableIds.begin()); iter!=deletableIds.end(); ++iter)
-                mUndoStack.push (new CSMWorld::DeleteCommand (*mModel, *iter));
+                mDocument.getUndoStack().push (new CSMWorld::DeleteCommand (*mModel, *iter));
 
             if (deletableIds.size()>1)
-                mUndoStack.endMacro();
+                mDocument.getUndoStack().endMacro();
         }
     }
 }
@@ -364,7 +366,7 @@ void CSVWorld::Table::moveUpRecord()
             for (int i=1; i<row2-row; ++i)
                 newOrder[i] = i;
 
-            mUndoStack.push (new CSMWorld::ReorderRowsCommand (*mModel, row, newOrder));
+            mDocument.getUndoStack().push (new CSMWorld::ReorderRowsCommand (*mModel, row, newOrder));
         }
     }
 }
@@ -393,7 +395,7 @@ void CSVWorld::Table::moveDownRecord()
             for (int i=1; i<row2-row; ++i)
                 newOrder[i] = i;
 
-            mUndoStack.push (new CSMWorld::ReorderRowsCommand (*mModel, row, newOrder));
+            mDocument.getUndoStack().push (new CSMWorld::ReorderRowsCommand (*mModel, row, newOrder));
         }
     }
 }
@@ -551,7 +553,7 @@ void CSVWorld::Table::dropEvent(QDropEvent *event)
             std::auto_ptr<CSMWorld::ModifyCommand> command (new CSMWorld::ModifyCommand
                     (*mProxyModel, index, QVariant (QString::fromUtf8 (record.getId().c_str()))));
 
-            mUndoStack.push (command.release());
+            mDocument.getUndoStack().push (command.release());
         }
     } //TODO handle drops from different document
 }
diff --git a/apps/opencs/view/world/table.hpp b/apps/opencs/view/world/table.hpp
index 3791bf4ac2..e8d5648d16 100644
--- a/apps/opencs/view/world/table.hpp
+++ b/apps/opencs/view/world/table.hpp
@@ -10,13 +10,14 @@
 #include "../../model/filter/node.hpp"
 #include "../../model/world/columnbase.hpp"
 
-namespace CSMDoc {
-    class Document;
-}
-
 class QUndoStack;
 class QAction;
 
+namespace CSMDoc
+{
+    class Document;
+}
+
 namespace CSMWorld
 {
     class Data;
@@ -35,7 +36,6 @@ namespace CSVWorld
             Q_OBJECT
 
             std::vector<CommandDelegate *> mDelegates;
-            QUndoStack& mUndoStack;
             QAction *mEditAction;
             QAction *mCreateAction;
             QAction *mCloneAction;
@@ -48,11 +48,7 @@ namespace CSVWorld
             CSMWorld::IdTable *mModel;
             bool mEditLock;
             int mRecordStatusDisplay;
-            CSMWorld::Data& mData;
-
-            /// \brief This variable is used exclusivly for checking if dropEvents came from the same document. Most likely you
-            /// should NOT use it for anything else.
-            const CSMDoc::Document& mDocument;
+            CSMDoc::Document& mDocument;
 
         private:
 
@@ -72,9 +68,8 @@ namespace CSVWorld
 
         public:
 
-            Table (const CSMWorld::UniversalId& id, CSMWorld::Data& data, QUndoStack& undoStack, bool createAndDelete,
-                   bool sorting, const CSMDoc::Document& document);
-
+            Table (const CSMWorld::UniversalId& id, bool createAndDelete,
+                bool sorting, CSMDoc::Document& document);
             ///< \param createAndDelete Allow creation and deletion of records.
             /// \param sorting Allow changing order of rows in the view via column headers.
 
diff --git a/apps/opencs/view/world/tablesubview.cpp b/apps/opencs/view/world/tablesubview.cpp
index 30a60536ae..2d08d186e5 100644
--- a/apps/opencs/view/world/tablesubview.cpp
+++ b/apps/opencs/view/world/tablesubview.cpp
@@ -24,7 +24,7 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D
         new TableBottomBox (creatorFactory, document.getData(), document.getUndoStack(), id, this), 0);
 
     layout->insertWidget (0, mTable =
-        new Table (id, document.getData(), document.getUndoStack(), mBottom->canCreateAndDelete(), sorting, document), 2);
+        new Table (id, mBottom->canCreateAndDelete(), sorting, document), 2);
 
     CSVFilter::FilterBox *filterBox = new CSVFilter::FilterBox (document.getData(), this);