diff --git a/lib/node.cpp b/lib/node.cpp
index e718ec47a30993fc26219dd7ffa1bdea7c310eb4..108d063d9f81125edb65de0645f1074a380cc350 100644
--- a/lib/node.cpp
+++ b/lib/node.cpp
@@ -37,10 +37,6 @@ Node::Node(Node* root, Node* parent, double* masses, double* particles, unsigned
         mass_ += masses_[localParticles_[i]];
     }
 
-    // TODO
-    // allocate children
-    // check if child contains no particles, in that case set child to nullptr
-    // check if node is leaf (it contains a single particle), in that case all children are nullptr
     if (nLocalParticles <= 1) {
         isLeaf_ = true;
         for (unsigned i=0; i<8; ++i)
@@ -93,13 +89,10 @@ Node& Node::operator=(const Node& other) {
     return *this;
 }
 
-void Node::update(List& localParticles) {
-    // TODO
-    // update center of mass
-    // maybe subdivide? 
-    // update this node
-    // update children
-
+void Node::update(List& localParticles, unsigned nLocalParticles) {
+    calculateCenterOfMass();
+    localParticles_ = localParticles;
+    nLocalParticles_ = nLocalParticles;
     // for each local particle, determine which octant it is in
     List* particleDivision = new List[nLocalParticles_];
     for (unsigned i=0; i<nLocalParticles_; ++i) {
@@ -115,7 +108,7 @@ void Node::update(List& localParticles) {
                 delete children_[i];
                 children_[i] = nullptr;
             } else {
-                children_[i]->update(particleDivision[i]);
+                children_[i]->update(particleDivision[i], particleDivision[i].size());
                 isLeaf_ = false;
             }
         } else {
diff --git a/lib/node.hpp b/lib/node.hpp
index d8c900d0987504a50981f505b1762ca7cbad9547..661bd70b1a2d404b5d1f0be09546edb627bd20ed 100644
--- a/lib/node.hpp
+++ b/lib/node.hpp
@@ -19,7 +19,7 @@ public:
     // Copy assignment
     Node& operator=(const Node&);
     // Update tree: visit each node, check if it needs to be split or merged (for example if a particle has left the region)
-    void update(List& allParticles);
+    void update(List& particles, unsigned nParticles);
     // Calculate force on a particle recursively
     double* calculateForce(unsigned particle);
     // Calculate center of mass
diff --git a/lib/tree.cpp b/lib/tree.cpp
index 7ff2bce087b6ed3664cfd366aa16d3273013a51e..eb27fa844f5f433f13524a941bd5e9ef85f45c0b 100644
--- a/lib/tree.cpp
+++ b/lib/tree.cpp
@@ -32,5 +32,5 @@ void Tree::calculateForce(unsigned particle) {
 }
 
 void Tree::update() {
-    root_->update(allParticles_);
+    root_->update(allParticles_, nParticles_);
 }
\ No newline at end of file
diff --git a/lib/tree.hpp b/lib/tree.hpp
index bdab71c81f3ceebd39860867cf83b370dd0ad7dd..e95ed362f168b84bf924ca825f6ff7b7ef791118 100644
--- a/lib/tree.hpp
+++ b/lib/tree.hpp
@@ -28,6 +28,7 @@ private:
     double size_;
     double center_[3];
 
+    // allParticles contains all indices, so [0, 1, 2, ..., nParticles_-1]. It should never be changed. 
     std::vector<unsigned> allParticles_;
 };