diff --git a/dune/fufem/mechanics/cubictensor.hh b/dune/fufem/mechanics/cubictensor.hh
index 3fc8f12aa3cec20889f214923c4b259d10618d33..acb94f2e0b925a3c4fae0988558fe4df8c7159c0 100644
--- a/dune/fufem/mechanics/cubictensor.hh
+++ b/dune/fufem/mechanics/cubictensor.hh
@@ -4,14 +4,16 @@
 #include "elasticitytensor.hh"
 
 template <int dim>
-class CubicTensor : public ElasticityTensor<dim>
+class CubicTensor;
+
+template <>
+class CubicTensor<3> : public ElasticityTensor<3>
 {
     public:
         CubicTensor(double C11, double C12, double C44) {
 
-            ElasticityTensor<dim>::operator=(0.0);
+            ElasticityTensor<3>::operator=(0.0);
 
-            if (dim == 3) {
                 (*this)[0][0] = C11;
                 (*this)[1][1] = C11;
                 (*this)[2][2] = C11;
@@ -25,25 +27,24 @@ class CubicTensor : public ElasticityTensor<dim>
                 (*this)[1][2] = C12;
                 (*this)[2][0] = C12;
                 (*this)[2][1] = C12;
-            }
-            else if (dim == 2) {
+        }
+};
+
+template <>
+class CubicTensor<2> : public ElasticityTensor<2>
+{
+    public:
+        CubicTensor(double C11, double C12, double C44) {
+
+            ElasticityTensor<2>::operator=(0.0);
+
                 (*this)[0][0] = C11;
                 (*this)[1][1] = C11;
                 (*this)[2][2] = 2*C44;
 
                 (*this)[0][1] = C12;
                 (*this)[1][0] = C12;
-
-            }
         }
-
-        /*	double getTensorEntry(const int i, const int j, const int k, const int l)
-            {
-
-            }
-            double getVoigtEntry(const int i, const int j)
-            {
-            }*/
 };