diff --git a/src/dg1d.jl b/src/dg1d.jl
index d8ee23d941dc445bc2e1d33189d199d06ec236b1..5766220ea1fb3f7e70ac0b32cd8e502df310c1b2 100644
--- a/src/dg1d.jl
+++ b/src/dg1d.jl
@@ -58,8 +58,9 @@ module dg1d
   include("tensorbasis.jl")
   include("box.jl")
   include("tree.jl")
-
   include("cache.jl")
+  include("grid.jl")
+
   include("callbacks.jl")
 
   include("numericalflux.jl")
diff --git a/src/mwe.jl b/src/mwe.jl
index fcfe9a25f5ba68ec4df28ecfb84b751bc9d438c8..1da493e86c3389a12f208fd993673bdfc7fb86ea 100644
--- a/src/mwe.jl
+++ b/src/mwe.jl
@@ -1,9 +1,102 @@
-using StructArrays
+function connected_matrix(Nx, Ny)
+  M = zeros(Int64, Nx, Ny)
 
+  NN = length(M)
+  ix, iy = 1, 1
+  ix_dir = 1
+  n = 1
+  while n <= NN
+    M[ix,iy] = n
+    n += 1
 
-x, y, z = [ randn(5) for _ = 1:3 ]
+    if ix_dir > 0
+      if ix < Nx
+        ix += 1
+      else
+        iy += 1
+        ix_dir *= -1
+      end
+    else
+      if ix > 1
+        ix -= 1
+      else
+        iy += 1
+        ix_dir *= -1
+      end
+    end
+  end
+  
+  return M
+end
 
-Vf = Vector{Float64}
-soa = StructArray{Tuple{Tuple{Vf,Vf}, Vf}}(((x,y),z))
 
+function connected_matrix(Nx, Ny, Nz)
+  M = zeros(Int64, Nx, Ny, Nz)
+  ijks = NTuple{3,Int64}[]
 
+  NN = length(M)
+  ix, iy, iz = 1, 1, 1
+  ix_dir, iy_dir = 1, 1
+  n = 1
+  while n <= NN
+    M[ix,iy,iz] = n
+    push!(ijks, (ix,iy,iz))
+    n += 1
+
+    if ix_dir > 0
+      if ix < Nx
+        ix += 1
+      else
+        if iy_dir > 0
+          if iy < Ny
+            iy += 1
+          else
+            iz += 1
+            iy_dir *= -1
+          end
+        else
+          if iy > 1
+            iy -= 1
+          else
+            iz += 1
+            iy_dir *= -1
+          end
+        end
+        ix_dir *= -1
+      end
+    else
+      if ix > 1
+        ix -= 1
+      else
+        if iy_dir > 0
+          if iy < Ny
+            iy += 1
+          else
+            iz += 1
+            iy_dir *= -1
+          end
+        else
+          if iy > 1
+            iy -= 1
+          else
+            iz += 1
+            iy_dir *= -1
+          end
+        end
+        ix_dir *= -1
+      end
+    end
+
+  end
+  
+  return M, ijks
+end
+
+M2d = connected_matrix(10, 10)
+display(M2d)
+M3d, ijks = connected_matrix(4,4,4)
+display(ijks)
+# display(M3d)
+# for mijk in M3d
+#   println(mijk)
+# end
diff --git a/src/tensorbasis.jl b/src/tensorbasis.jl
index fabb58a84e2c5cb18e93961ed13fcea6e42d46b8..dd07259767d4a96e98a640f430478d28725fb234 100644
--- a/src/tensorbasis.jl
+++ b/src/tensorbasis.jl
@@ -19,6 +19,9 @@ const TensorBasis1d = TensorBasis{1}
 const TensorBasis2d = TensorBasis{2}
 const TensorBasis3d = TensorBasis{3}
 
+
+TensorBasis(se::SpectralElement...) = TensorBasis{length(se)}(se...)
+
 Base.getindex(b::TensorBasis, idx::Int) = b.basis[idx]
 # avoid bounds check with enums
 # can we generalize Cart1d,Cart2d,Cart3d based on dimensions for other corodinates?
@@ -53,10 +56,10 @@ end
 
 
 function range_volume(tb::TensorBasis, offset=1)
-  return range(offset, offset+n_points(tb)-1)
+  return Base.range(offset, length=offset+n_points(tb)-1)
 end
 function range_boundary(tb::TensorBasis, offset=1)
-  return range(offset, offset+n_points_boundary(tb))
+  return Base.range(offset, length=offset+n_points_boundary(tb))
 end