     void Update(float deltaTime){
         self.position.z -= speed*deltaTime;
         
-        if (self.position.z < 450.0f && stopTime < endTime){
+        // Braking phase
+        if (hasHitPlane && stopTime < endTime){
             stopTime += deltaTime;
             float t = stopTime;
             float zPos = a * t * t * t / 3.0f + b * t * t / 2.0f + c * t;
             self.position.z = 450.0f - zPos;
-        } else if (stopTime >= endTime && !trigger) {
+        }
+        // Stopping phase
+        else if (stopTime >= endTime && !trigger) {
             self.position.z = 400.0f;
             speed = 0.0f;
-        } else if (trigger){
+        }
+        // Start again after lever has been pulled
+        else if (trigger){
             if (speed < 20.0f)
                 speed += 0.0664f;
         }
-        
-        
     }
     
     void ReceiveMessage(int signal){

        speed = 20.0f;
        stopTime = 0.0f;
        endTime = 7.5f;
        
        // Calculate second grade equation.
        float t = endTime;

    float a;
    float b;
    float c;
    bool hasHitPlane;
    
    Component::Physics @minecartPhysics;
    Component::Physics @stopPhysics;
