diff --git a/js/fea/DmaCell.js b/js/fea/DmaCell.js
index ef565e174ca788219515f3a30584ab4b9784b0fc..08d23a57cd518fdb983ab871db8bc9bdf394078b 100644
--- a/js/fea/DmaCell.js
+++ b/js/fea/DmaCell.js
@@ -13,8 +13,8 @@ function DMACell(indices, scale, lattice) {
     this.parts = this._initParts(indices.z);
     this.updateForScale(scale);
 
-    window.three.sceneAdd(this.cellMesh, "cell");
-    this.drawForMode(window.appState.get("cellMode"));
+    dmaGlobals.three.sceneAdd(this.cellMesh, "cell");
+    this.drawForMode(dmaGlobals.appState.get("cellMode"));
 }
 
 DMACell.prototype.removePart = function(index){
@@ -78,7 +78,7 @@ DMACell.prototype.getIndex = function(){
 
 DMACell.prototype.destroy = function(){
     if (this.cellMesh) {
-        window.three.sceneRemove(this.cellMesh, "cell");
+        dmaGlobals.three.sceneRemove(this.cellMesh, "cell");
         this.cellMesh.myParent = null;
 //            this.cellMesh.dispose();
 //            geometry.dispose();
diff --git a/js/fea/DmaNode.js b/js/fea/DmaNode.js
index 83f2057fedfc9f5020d87ddb64b4a082daa638a6..b20b8bb997554007755849911681548d30419679 100644
--- a/js/fea/DmaNode.js
+++ b/js/fea/DmaNode.js
@@ -18,7 +18,7 @@ BeamNode.prototype.render = function(){
     geometry.applyMatrix( new THREE.Matrix4().makeTranslation(this.x, this.y, this.z) );
     var mesh = new THREE.Mesh(geometry);
 
-//    window.three.sceneAdd(mesh);
+//    dmaGlobals.three.sceneAdd(mesh);
 };
 
 
diff --git a/js/fea/DmaPart.js b/js/fea/DmaPart.js
index 34e02bfadf84cbba54e2b4afc315c4d6c1ba49b2..c7af2da0fd7da8a953b81277516f010eea161e36 100644
--- a/js/fea/DmaPart.js
+++ b/js/fea/DmaPart.js
@@ -16,7 +16,7 @@
         if (this.mesh) console.warn("part mesh already in scene");
         this.mesh = this._makeMeshForType(this.type);
         this.updateForScale(this.parentCell.getScale(), this.parentCell.getPosition());
-        window.three.sceneAdd(this.mesh, "part");
+        dmaGlobals.three.sceneAdd(this.mesh, "part");
     };
 
     DMAPart.prototype.updateForScale = function(scale, position){
@@ -53,13 +53,13 @@
     DMAPart.prototype.removeFromCell = function(){//send message back to parent cell to destroy this
         if (this.parentCell) {
             this.parentCell.removePart(this.type);
-            window.three.render();
+            dmaGlobals.three.render();
         } else console.warn("part has no parent cell");
     };
 
     DMAPart.prototype.destroy = function(){
         if (this.mesh) {
-            window.three.sceneRemove(this.mesh, "part");
+            dmaGlobals.three.sceneRemove(this.mesh, "part");
             this.mesh.myPart = null;
 //            this.mesh.dispose();
 //            geometry.dispose();
diff --git a/js/main.js b/js/main.js
index 6e90f8d9bd0c1bd4a80f409624dc52becd503c91..3e6e6889efef3507e924fbee353e2d3d56544f96 100644
--- a/js/main.js
+++ b/js/main.js
@@ -7,22 +7,24 @@ $(function(){
 
     //setup persistent global variables
 
+    dmaGlobals = {};
+
     //init web workers
     window.workers = persistentWorkers(8);
 
     //init threeJS and geometry models
-    window.three = new ThreeModel();
+    dmaGlobals.three = new ThreeModel();
 
-    window.lattice = new Lattice();
-    window.appState = new AppState({lattice:window.lattice});
+    dmaGlobals.lattice = new Lattice();
+    dmaGlobals.appState = new AppState({lattice:dmaGlobals.lattice});
 
 
 
     //ui
-    new NavBar({model:appState});
+    new NavBar({model:dmaGlobals.appState});
 
     //threeJS View
-    new ThreeView({model:window.three, appState:appState});
+    new ThreeView({model:dmaGlobals.three, appState:dmaGlobals.appState});
 
-    window.lattice.addCellAtIndex({x:0,y:0,z:0});//add a cell
+    dmaGlobals.lattice.addCellAtIndex({x:0,y:0,z:0});//add a cell
 });
diff --git a/js/menus/LatticeMenuView.js b/js/menus/LatticeMenuView.js
index 04dc173decf13eff6a712d2d20df1285af86bee3..47cefba1eb627673a7c7935689573951233b8f1d 100644
--- a/js/menus/LatticeMenuView.js
+++ b/js/menus/LatticeMenuView.js
@@ -43,7 +43,7 @@ LatticeMenuView = Backbone.View.extend({
 //        this.lattice.set("scale", $(e.target)[0].value);
         this.lattice.previewScaleChange(scale);//does not trigger lattice change event - no rerendering of ui
         $("#latticeScale").val(scale);
-        window.three.render();
+        dmaGlobals.three.render();
     },
 
     _changeScaleSlider: function(e){
diff --git a/js/models/BasePlane.js b/js/models/BasePlane.js
index f88fa498a3c3ef9a13045fda30a023c12789974b..c52308adae50c84e05b2c8641da022020cdc9ce1 100644
--- a/js/models/BasePlane.js
+++ b/js/models/BasePlane.js
@@ -27,9 +27,9 @@ BasePlane = Backbone.Model.extend({
 
         var self = this;
         _.each(this.get("mesh"), function(mesh){
-            window.three.sceneAdd(mesh, self._checkIsHighlightable(mesh));
+            dmaGlobals.three.sceneAdd(mesh, self._checkIsHighlightable(mesh));
         });
-        window.three.render();
+        dmaGlobals.three.render();
 
     },
 
@@ -52,7 +52,7 @@ BasePlane = Backbone.Model.extend({
     },
 
     getIndex: function(face){
-        return window.lattice.getIndexForPosition(face.geometry.vertices[0]);
+        return dmaGlobals.lattice.getIndexForPosition(face.geometry.vertices[0]);
     },
 
     //subclasses handle getHighlighterVertices
@@ -65,9 +65,9 @@ BasePlane = Backbone.Model.extend({
         var self = this;
         _.each(this.get("mesh"), function(mesh){
             if (mesh.myParent) mesh.myParent = null;
-            window.three.sceneRemove(mesh, self._checkIsHighlightable(mesh));
+            dmaGlobals.three.sceneRemove(mesh, self._checkIsHighlightable(mesh));
         });
-        window.three.render();
+        dmaGlobals.three.render();
     },
 
     destroy: function(){
@@ -128,11 +128,11 @@ OctaBasePlane = BasePlane.extend({
 
     _renderZIndexChange: function(){
         var zIndex = this.get("zIndex");
-        var scale = this.get("mesh")[0].scale.z;
+        var scale = dmaGlobals.lattice.get("scale");
         _.each(this.get("mesh"), function(mesh){
             mesh.position.set(0, 0, zIndex*scale*2/Math.sqrt(6));
         });
-        window.three.render();
+        dmaGlobals.three.render();
     },
 
     _calcOctaFaceVertices: function(colSep){
@@ -177,7 +177,7 @@ OctaBasePlane = BasePlane.extend({
         var mesh = this.get("mesh")[0];
         var vertices = mesh.geometry.vertices;
         var newVertices = [vertices[face.a].clone(), vertices[face.b].clone(), vertices[face.c].clone()];
-        var scale = mesh.scale.x;
+        var scale = dmaGlobals.lattice.get("scale");
         var position = (new THREE.Vector3()).setFromMatrixPosition(mesh.matrixWorld);
         _.each(newVertices, function(vertex){//apply scale
             vertex.multiplyScalar(scale);
@@ -225,18 +225,18 @@ SquareBasePlane = BasePlane.extend({
 
     _renderZIndexChange: function(){
         var zIndex = this.get("zIndex");
-        var scale = this.get("mesh")[0].scale.z;
+        var scale = dmaGlobals.lattice.get("scale");
         _.each(this.get("mesh"), function(mesh){
             mesh.position.set(0, 0, zIndex*scale);
         });
-        window.three.render();
+        dmaGlobals.three.render();
     },
 
     getHighlighterVertices: function(face, position){
         //the vertices don't include the position transformation applied to cell.  Add these to create highlighter vertices
-        var index = window.lattice.getIndexForPosition(position);
+        var index = dmaGlobals.lattice.getIndexForPosition(position);
         index.z += 1;
-        var scale = this.get("mesh")[0].scale.x;
+        var scale = dmaGlobals.lattice.get("scale");
         var vertices = [];
         vertices.push(new THREE.Vector3(index.x*scale, index.y*scale, index.z*scale));
         vertices.push(new THREE.Vector3((index.x+1)*scale, index.y*scale, index.z*scale));
diff --git a/js/models/FillGeometry.js b/js/models/FillGeometry.js
index 0aad2f7da758bbae90de79d811d5d3daf2fe4763..1b20f6742f7b0209566e3fedb3824d8c522603b5 100644
--- a/js/models/FillGeometry.js
+++ b/js/models/FillGeometry.js
@@ -43,8 +43,8 @@ FillGeometry = Backbone.Model.extend({
         var mesh = new THREE.Mesh(this.get("geometry"), this.get("material"));
         this.makeBoundingBoxHelper(mesh);
         this.set({mesh: mesh});
-        window.three.sceneAdd(mesh, null);
-        window.three.render();
+        dmaGlobals.three.sceneAdd(mesh, null);
+        dmaGlobals.three.render();
 
         //send new geometry out to workers
 //            _.each(workers.allWorkers, function(worker){
@@ -74,9 +74,9 @@ FillGeometry = Backbone.Model.extend({
 
     remove: function(){
         if (!this.get("mesh")) return;
-        window.three.sceneRemove(this.get("mesh"), null);
+        dmaGlobals.three.sceneRemove(this.get("mesh"), null);
         this.set("mesh", null);
-        window.three.render();
+        dmaGlobals.three.render();
     },
 
     scale: function(scale){
diff --git a/js/models/Lattice.js b/js/models/Lattice.js
index c3705b85146fd4969c8154da4adefd62921699ea..70c12184e739088be2b16ee9b30f873269d5f983 100644
--- a/js/models/Lattice.js
+++ b/js/models/Lattice.js
@@ -48,7 +48,7 @@ Lattice = Backbone.Model.extend({
                 }
             }
         }
-        window.three.render();
+        dmaGlobals.three.render();
     },
 
     addCellAtIndex: function(indices){
@@ -61,7 +61,7 @@ Lattice = Backbone.Model.extend({
         if (!cells[index.x][index.y][index.z]) {
             cells[index.x][index.y][index.z] = this._makeCellForLatticeType(indices, scale);
             this.set("numCells", this.get("numCells")+1);
-            window.three.render();
+            dmaGlobals.three.render();
         } else console.warn("already a cell there");
 
     },
@@ -85,7 +85,7 @@ Lattice = Backbone.Model.extend({
         //todo shrink cells matrix if needed
 
         this.set("numCells", this.get("numCells")-1);
-        window.three.render();
+        dmaGlobals.three.render();
     },
 
     clearCells: function(){
@@ -98,7 +98,7 @@ Lattice = Backbone.Model.extend({
         this.set("nodes", []);
         this.set("numCells", 0);
         if (this.get("basePlane")) this.get("basePlane").set("zIndex", 0);
-        window.three.render();
+        dmaGlobals.three.render();
     },
 
     ////////////////////////////////////////////////////////////////////////////////////
@@ -138,7 +138,7 @@ Lattice = Backbone.Model.extend({
             }
 
         }
-        window.three.render();
+        dmaGlobals.three.render();
     },
 
     _findIntersectionsInWindow: function(windowX, windowY, origin, allVertexPos){
@@ -264,7 +264,7 @@ Lattice = Backbone.Model.extend({
         this._iterCells(this.get("cells"), function(cell){
             if (cell && cell.drawForMode) cell.drawForMode(mode);
         });
-        window.three.render();
+        dmaGlobals.three.render();
     },
 
     _scaleDidChange: function(){
@@ -273,7 +273,7 @@ Lattice = Backbone.Model.extend({
         this._iterCells(this.get("cells"), function(cell){
             if (cell) cell.updateForScale(scale);
         });
-        window.three.render();
+        dmaGlobals.three.render();
     },
 
     previewScaleChange: function(scale){
@@ -348,7 +348,7 @@ Lattice = Backbone.Model.extend({
             this._iterCells(this.get("cells"), function(cell){
                 if (cell) cell.updateForScale(scale);
             });
-            window.three.render();
+            dmaGlobals.three.render();
         },
 
         getIndexForPosition: function(absPosition){
@@ -412,7 +412,7 @@ Lattice = Backbone.Model.extend({
             this._iterCells(this.get("cells"), function(cell){
                 if (cell) cell.updateForScale(scale);
             });
-            window.three.render();
+            dmaGlobals.three.render();
         },
 
         getIndexForPosition: function(absPosition){
diff --git a/js/models/extrudeVisualizer.js b/js/models/extrudeVisualizer.js
index 10cf1691c2ee26898ff184454065329ed2835178..af363dba103403534af7f6ffa3a846d1ed8a7bba 100644
--- a/js/models/extrudeVisualizer.js
+++ b/js/models/extrudeVisualizer.js
@@ -18,10 +18,10 @@ function ExtrudeVisualizer(){
             mesh.position.x = profilePos.x;
             mesh.position.y = profilePos.y;
             mesh.position.z = profilePos.z;
-//            window.three.sceneAdd(mesh, false);
+//            dmaGlobals.three.sceneAdd(mesh, false);
             meshes.push(mesh);
         });
-        window.three.render();
+        dmaGlobals.three.render();
     }
 
     function makeHandle(){
@@ -36,7 +36,7 @@ function ExtrudeVisualizer(){
         _.each(meshes, function(mesh){
             mesh.scale.z = height;
         })
-        window.three.render();
+        dmaGlobals.three.render();
     }
 
     function renderIntoCells(){
diff --git a/js/threeViews/Highlighter.js b/js/threeViews/Highlighter.js
index c53d76b1715f49e28bd44f53e711e42e6dfd5809..1ff9dd41326ce2ada99d1469774326687e244067 100644
--- a/js/threeViews/Highlighter.js
+++ b/js/threeViews/Highlighter.js
@@ -20,7 +20,7 @@ Highlighter = Backbone.View.extend({
                 vertexColors:THREE.FaceColors
             }));
 
-        window.three.sceneAdd(this.mesh, null);
+        dmaGlobals.three.sceneAdd(this.mesh, null);
         this.hide();
 
         //bind events
@@ -41,7 +41,7 @@ Highlighter = Backbone.View.extend({
     _setVisibility: function(visible, forceRender){
         if (forceRender || this.isVisible() != visible){
             this.mesh.visible = visible;
-            window.three.render();
+            dmaGlobals.three.render();
         }
         this.mesh.visible = visible;
     },
@@ -88,18 +88,18 @@ Highlighter = Backbone.View.extend({
 
         if (shouldAdd){
             if (!this.isVisible() || !this.highlightedObject) return;
-            window.lattice.addCellAtIndex(this._getNextCellPosition(this.highlightedObject.getIndex(this.mesh)));
+            dmaGlobals.lattice.addCellAtIndex(this._getNextCellPosition(this.highlightedObject.getIndex(this.mesh)));
         } else {
             if (!this.highlightedObject) return;
             if (!(this.highlightedObject instanceof DMACell)) return;
-            window.lattice.removeCell(this.highlightedObject);
+            dmaGlobals.lattice.removeCell(this.highlightedObject);
         }
         this.hide();
         this.highlightedObject = null;
     },
 
     destroy: function(){
-        window.three.sceneRemove(this.mesh, null);
+        dmaGlobals.three.sceneRemove(this.mesh, null);
         this.mesh = null;
         this.highlightedObject = null;
         this.stopListening();
diff --git a/js/threeViews/ThreeView.js b/js/threeViews/ThreeView.js
index e153351332ec07f449465c9d7229c595452c6d4c..3fd1c6d1cdb32f1bf75d46c6b72416e898bef42a 100644
--- a/js/threeViews/ThreeView.js
+++ b/js/threeViews/ThreeView.js
@@ -30,7 +30,7 @@ ThreeView = Backbone.View.extend({
 
         //bind events
         this.listenTo(this.appState, "change:deleteMode change:extrudeMode change:shift", this._setControlsEnabled);
-        this.listenTo(window.lattice, "change:highlighter", this._saveHighlighter);
+        this.listenTo(dmaGlobals.lattice, "change:highlighter", this._saveHighlighter);
 
         this._saveHighlighter();//need a reference to the highlighter
 
@@ -125,14 +125,14 @@ ThreeView = Backbone.View.extend({
     ////////////////////////////////////////////////////////////////////////////////
 
     _saveHighlighter: function(){
-        this.highlighter = window.lattice.get("highlighter");
+        this.highlighter = dmaGlobals.lattice.get("highlighter");
     },
 
     _setNoPartIntersections: function(){
         if (this.currentIntersectedPart){
             this.currentIntersectedPart.unhighlight();
             this.currentIntersectedPart = null;
-            window.three.render();
+            dmaGlobals.three.render();
         }
     },
 
@@ -147,7 +147,7 @@ ThreeView = Backbone.View.extend({
             if (this.currentIntersectedPart) this.currentIntersectedPart.unhighlight();
             part.highlight();
             this.currentIntersectedPart = part;
-            window.three.render();
+            dmaGlobals.three.render();
         }
     }