diff --git a/src/fitting_chi2_linear.cpp b/src/fitting_chi2_linear.cpp
index 56c5624d728411148fa5336babd5d9eaa8ce8bb9..a8ad8a9d78cbcf76679a06316f7bcc0fbd85c41f 100644
--- a/src/fitting_chi2_linear.cpp
+++ b/src/fitting_chi2_linear.cpp
@@ -39,7 +39,6 @@ void print_instructions(){
   exit(1);
 }
 
-
 /*! Chi2 fitting of a straight tracklets */ 
 bool fitStraightTracklets(TFRTrack *track,
 			  TFRGeometry *detector_geo,
@@ -59,14 +58,39 @@ bool fitStraightTracklets(TFRTrack *track,
   //  compose the two tracklets  //
   //-----------------------------//
 
-  //TASK: loop over the clusters, to form the two tracklets
+  //loop over the clusters, to form the two tracklets
+  
+  //I've no clue why the hell in ROOT there aren't nice implementations of iterators,
+  //but just this stupid way (that I even didn't used at my C course during my bachelor)
+  TIter it_cluster((TFRClusters*) track->GetClusters());
+  TFRCluster *curr_cluster;
+
+  //loop over the clusters
+  while((curr_cluster = (TFRCluster*) it_cluster.Next())){
+
+    //before magnetic region?
+    if(curr_cluster->GetZ() < detector_geo->GetBFieldStartZ())
+      track_beforeB->AddCluster(curr_cluster);
+
+    //after magnetic region?
+    if(curr_cluster->GetZ() > detector_geo->GetBFieldEndZ())
+      track_afterB->AddCluster(curr_cluster);
+
+  }  //loop over the clusters
+     
+  //check that everything went fine
+  if((track_beforeB->GetNClusters() <= 0)
+     || (track_afterB->GetNClusters() <= 0)){
+    std::cout << "Error: the tracklets before and after B are not correctly set" << std::endl;
+    return false;
+  }
   
   //-------------------------------------------//
   //  now I can finally fit the two tracklets  //
   //-------------------------------------------//
 
   //TASK: fit the two tracklets on the XZ plane
-
+  
   //----------------//
   //  set the chi2  //
   //----------------//
@@ -80,10 +104,20 @@ bool fitStraightTracklets(TFRTrack *track,
     track->SetFitStatus(false);
     return false;
   }  //check the chi2 of the tracklets
+  
+  
+  //TASK: set the XZ parameters of the complete track.
+  //      Later we will extrapolate the track to the vertex (z = 0),
+  //      so from which of the two tracklets are you taking the parameters?
 
+  //track->SetTrackParamsXZ( ?? );
 
-  //TASK: set the XZ parameters of the complete track: from which tracklet?
+  
   //TASK: set the chi2 of the complete track, starting from the chi2 of the two tracklets
+
+  //track->SetChi2( ?? );
+  //track->SetNdoF( ?? );
+  //track->SetChi2NdoF( ?? );
   
   //----------------------------------------------//
   //  estimate the momentum on the bending plane  //
@@ -104,6 +138,9 @@ bool fitStraightTracklets(TFRTrack *track,
   
   //TASK: compute the 3 components of the momentum and their errors
   
+  //track->SetMomentum( ?? );
+  //track->SetMomentumErr( ?? );
+  
   //the track is succesfully fitted!
   track->SetFitStatus(true);
   
diff --git a/src/fitting_chi2_quadratic.cpp b/src/fitting_chi2_quadratic.cpp
index 1b595ab5e0af12b336b260d59e2f47fe36a67d34..f455212eea6bc7ca3eee3cc7b3e8f54807de5e2a 100644
--- a/src/fitting_chi2_quadratic.cpp
+++ b/src/fitting_chi2_quadratic.cpp
@@ -58,8 +58,33 @@ bool fitStraightAndParabola(TFRTrack *track,
   //  compose the two tracklets  //
   //-----------------------------//
 
-  //TASK: loop over the clusters, to form the two tracklets
+  //loop over the clusters, to form the two tracklets
   
+  //I've no clue why the hell in ROOT there aren't nice implementations of iterators,
+  //but just this stupid way (that I even didn't used at my C course during my bachelor)
+  TIter it_cluster((TFRClusters*) track->GetClusters());
+  TFRCluster *curr_cluster;
+
+  //loop over the clusters
+  while((curr_cluster = (TFRCluster*) it_cluster.Next())){
+
+    //before magnetic region?
+    if(curr_cluster->GetZ() < detector_geo->GetBFieldStartZ())
+      track_beforeB->AddCluster(curr_cluster);
+
+    //in magnetic region?
+    if((curr_cluster->GetZ() > detector_geo->GetBFieldStartZ())
+       && (curr_cluster->GetZ() < detector_geo->GetBFieldEndZ()))
+      track_inB->AddCluster(curr_cluster);
+  }  //loop over the clusters
+
+  //check that everything went fine
+  if((track_beforeB->GetNClusters() <= 0)
+     || (track_inB->GetNClusters() <= 0)){
+    std::cout << "Error: the tracklets before and in B are not correctly set" << std::endl;
+    return false;
+  }
+
   //-------------------------------------------//
   //  now I can finally fit the two tracklets  //
   //-------------------------------------------//