diff --git a/src/Constraint.h b/src/Constraint.h
index ab5ef2d6637c7ab6da1e34713428e20833497a6d..df11565997cd230bebad790bbe15435acf15145b 100644
--- a/src/Constraint.h
+++ b/src/Constraint.h
@@ -9,26 +9,26 @@ struct Constraint {
 };
 
 class DistanceConstraint : public Constraint {
-    Particle *p1;
-    Particle *p2;
+    Particle& p1;
+    Particle& p2;
     float dist;
     float s; // weight of the constraint
 
 public:
-    DistanceConstraint(Particle *p1, Particle *p2, float dist, float s = 1.0f) :
+    DistanceConstraint(Particle& p1, Particle& p2, float dist, float s = 1.0f) :
             p1(p1), p2(p2), dist(dist), s(s) {}
 
     void solve() override {
-        vec3 d_p1 = -(p1->w / (p1->w + p2->w)) *
-                    (length(p1->tmp_pos - p2->tmp_pos) - dist) *
-                    (p1->tmp_pos - p2->tmp_pos) / length(p1->tmp_pos - p2->tmp_pos);
+        vec3 d_p1 = -(p1.w / (p1.w + p2.w)) *
+                    (length(p1.tmp_pos - p2.tmp_pos) - dist) *
+                    (p1.tmp_pos - p2.tmp_pos) / length(p1.tmp_pos - p2.tmp_pos);
 
-        vec3 d_p2 = (p2->w / (p1->w + p2->w)) *
-                    (length(p1->tmp_pos - p2->tmp_pos) - dist) *
-                    (p1->tmp_pos - p2->tmp_pos) / length(p1->tmp_pos - p2->tmp_pos);
+        vec3 d_p2 = (p2.w / (p1.w + p2.w)) *
+                    (length(p1.tmp_pos - p2.tmp_pos) - dist) *
+                    (p1.tmp_pos - p2.tmp_pos) / length(p1.tmp_pos - p2.tmp_pos);
 
-        p1->tmp_pos += s * d_p1;
-        p2->tmp_pos += s * d_p2;
+        p1.tmp_pos += s * d_p1;
+        p2.tmp_pos += s * d_p2;
     }
 };
 
diff --git a/src/PBDSimulation.cpp b/src/PBDSimulation.cpp
index be278e1695e851f1bb9a6c623a4064d9cdf6372a..b23c4b8a2a5fe069a14d2ebe53d5ec24366a4fa5 100644
--- a/src/PBDSimulation.cpp
+++ b/src/PBDSimulation.cpp
@@ -14,9 +14,9 @@ PBDSimulation::PBDSimulation(vec3 _head, size_t _nr_sims, size_t _nr_segments, f
     propagateHead();
 
     // set up distance constraints on each strand of hair
-    for (auto &strand : strands)
+    for (auto strand : strands)
         for (size_t i = 0; i < strand.size() - 1; i++)
-            constraints.push_back(new DistanceConstraint(strand[i], strand[i + 1], lSeg));
+            constraints.push_back(new DistanceConstraint(*strand[i], *strand[i + 1], lSeg));
 
     // set up bending constraint on each strand of hair
 //    for (auto &strand : strands)
diff --git a/src/main.cpp b/src/main.cpp
index 90a069d90286f8cd41b8f30dbd837aedda5cef27..172300537c6c709943b699d03dcc94799ef24e75 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -202,7 +202,7 @@ int main(int argc, char **argv) {
                   WIDTH, HEIGHT);
 
     vec3 headCenter(0.0f, 0.0f, 0.0f);
-    size_t nrSims = 200;
+    size_t nrSims = 1;
     size_t nrSegments = 30;
     float lSeg = 0.025f;
     auto hairSimulation = new PBDSimulation(headCenter, nrSims, nrSegments, lSeg);