diff --git a/NPLib/Core/RootOutput.cxx b/NPLib/Core/RootOutput.cxx
index d4cc71bcb9d3fe50355ddf83cf3334e48874d7f1..6a4ea51986fa49371db932fba15dbfc09f57fe66 100644
--- a/NPLib/Core/RootOutput.cxx
+++ b/NPLib/Core/RootOutput.cxx
@@ -138,7 +138,7 @@ void RootOutput::InitAsciiFiles(){
   pEventGenerator = new TAsciiFile();
   pEventGenerator->SetNameTitle("EventGenerator", fileNameEG.Data());
   pEventGenerator->Append(fileNameEG.Data());
-  pEventGenerator->Write();
+  pEventGenerator->Write(0,TAsciiFile::kOverwrite);
   
   // Detector configuration 
   // Get file name from NPOptionManager
@@ -146,7 +146,7 @@ void RootOutput::InitAsciiFiles(){
   pDetectorConfiguration = new TAsciiFile();
   pDetectorConfiguration->SetNameTitle("DetectorConfiguration", fileNameDC.Data());
   pDetectorConfiguration->Append(fileNameDC.Data());
-  pDetectorConfiguration->Write();
+  pDetectorConfiguration->Write(0,TAsciiFile::kOverwrite);
 
   // Run to treat file
   // Get file name from NPOptionManager
@@ -155,7 +155,7 @@ void RootOutput::InitAsciiFiles(){
     TString fileNameRT = OptionManager->GetRunToReadFile();
     pRunToTreatFile->SetNameTitle("RunToTreat", fileNameRT.Data());
     pRunToTreatFile->Append(fileNameRT.Data());
-    pRunToTreatFile->Write();
+    pRunToTreatFile->Write(0,TAsciiFile::kOverwrite);
   }
 
   // Calibration files
@@ -163,13 +163,13 @@ void RootOutput::InitAsciiFiles(){
   if (!OptionManager->IsDefault("Calibration")) {
     TString fileNameCal = OptionManager->GetCalibrationFile();
     pCalibrationFile->SetNameTitle("Calibration", fileNameCal.Data());
-    pCalibrationFile->Write();
+    pCalibrationFile->Write(0,TAsciiFile::kOverwrite);
   }
 
   // Analysis configuration files
   pAnalysisConfigFile = new TAsciiFile();
   pAnalysisConfigFile->SetNameTitle("AnalysisConfig", "AnalysisConfig");
-  pAnalysisConfigFile->Write();
+  pAnalysisConfigFile->Write(0,TAsciiFile::kOverwrite);
 }
 
 
@@ -180,11 +180,7 @@ RootOutput::~RootOutput(){
   if (pRootFile && !NPOptionManager::getInstance()->GetPROOF()) {
     TDirectory* currentPath= gDirectory;
     gDirectory->cd(pRootFile->GetPath());
-    cout << endl;
-    cout << endl << "Root Output summary" << endl;
-    cout << "  - Number of entries in the Tree: " << pRootTree->GetEntries() << endl;
-    cout << "  - Number of bites written to file: " << pRootTree->Write("", TObject::kOverwrite) << endl;
-
+   
     // write TAsciiFile if used
     // EventGenerator
     if (!pEventGenerator->IsEmpty()) pEventGenerator->Write(0,TAsciiFile::kOverwrite);
@@ -196,7 +192,15 @@ RootOutput::~RootOutput(){
     if (!pRunToTreatFile->IsEmpty()) pRunToTreatFile->Write(0,TAsciiFile::kOverwrite);
     // Analysis ConfigFile
     if (!pAnalysisConfigFile->IsEmpty()) pAnalysisConfigFile->Write(0,TAsciiFile::kOverwrite);
+   
+    cout << endl;
+    cout << endl << "Root Output summary" << endl;
+    cout << "  - Number of entries in the Tree: " << pRootTree->GetEntries() << endl;
+    cout << "  - Number of bites written to file: " << pRootTree->Write(0, TObject::kOverwrite) << endl;
+     
     pRootFile->Flush();
+    pRootFile->Purge(1);
+
     gDirectory->cd(currentPath->GetPath());
     pRootFile->Close();
   }
diff --git a/NPSimulation/Core/DetectorConstruction.cc b/NPSimulation/Core/DetectorConstruction.cc
index 2486a40282df1a5813a3c84e793c0f4231db5c41..4a9b29178638ba24f211eedc8e393bb94319a2fd 100644
--- a/NPSimulation/Core/DetectorConstruction.cc
+++ b/NPSimulation/Core/DetectorConstruction.cc
@@ -55,6 +55,7 @@
 #include "NPSDetectorFactory.hh"
 #include "MaterialManager.hh"
 #include "DetectorMessenger.hh"
+#include "ParticleStack.hh"
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 DetectorConstruction::DetectorConstruction():  world_log(0), world_phys(0){
@@ -156,7 +157,7 @@ G4VPhysicalVolume* DetectorConstruction::ReadConfigurationFile(){
 
     else if (LineBuffer.compare(0, 13, "GeneralTarget") == 0 && cGeneralTarget == false) {
       cGeneralTarget = true ;
-      if(VerboseLevel==1) G4cout << G4endl << "////////// Target ///////////" << G4endl   << G4endl   ;
+      if(VerboseLevel) G4cout << G4endl << "////////// Target ///////////" << G4endl   << G4endl   ;
 
       // Instantiate the new array as aNPS::VDetector Objects
       NPS::VDetector* myDetector = new Target();
@@ -179,7 +180,7 @@ G4VPhysicalVolume* DetectorConstruction::ReadConfigurationFile(){
 
     else if (LineBuffer.compare(0, 14, "GeneralChamber") == 0 && cGeneralChamber == false) {
       cGeneralChamber = true ;
-      if(VerboseLevel==1) G4cout << G4endl << "////////// Chamber ///////////" << G4endl   << G4endl   ;
+      if(VerboseLevel) G4cout << G4endl << "////////// Chamber ///////////" << G4endl   << G4endl   ;
 
       // Instantiate the new array as aNPS::VDetector Objects
       NPS::VDetector* myDetector = new Chamber();
@@ -202,10 +203,12 @@ G4VPhysicalVolume* DetectorConstruction::ReadConfigurationFile(){
       oss >> token ;
       NPS::VDetector* detector = theFactory->Construct(token);
       if(detector!=NULL && check.find(token)==check.end()){
+        if(VerboseLevel){
         cout << "/////////////////////////////////////////" << endl;
         cout << "//// Adding Detector " << token << endl; 
         detector->ReadConfiguration(Path);
         cout << "/////////////////////////////////////////" << endl;
+        }
         // Add array to the VDetector Vector
         AddDetector(detector);
         check.insert(token);
@@ -276,9 +279,13 @@ void DetectorConstruction::ClearGeometry(){
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 void DetectorConstruction::RedefineGeometry(std::string file){
   ClearGeometry() ;
+ 
+//  RootOutput::getInstance()->GetTree()->FlushBaskets();
+//  RootOutput::getInstance()->GetTree()->AutoSave();
+//  RootOutput::getInstance()->GetTree()->GetCurrentFile()->Write();
 
-  RootOutput::getInstance()->GetTree()->ResetBranchAddresses(); 
-  RootOutput::getInstance()->GetTree()->GetListOfBranches()->Clear(); 
+//  RootOutput::getInstance()->GetTree()->ResetBranchAddresses(); 
+//RootOutput::getInstance()->GetTree()->GetListOfBranches()->Clear(); 
 
   if(file!="")
     NPOptionManager::getInstance()->SetDetectorFile(file);
@@ -286,6 +293,8 @@ void DetectorConstruction::RedefineGeometry(std::string file){
   G4RunManager::GetRunManager()->DefineWorldVolume(Construct());
   G4RunManager::GetRunManager()->GeometryHasBeenModified();
   G4RunManager::GetRunManager()->Initialize();
+
+  ParticleStack::getInstance()->AttachInitialConditions();  
 }
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -298,8 +307,5 @@ void DetectorConstruction::ExportGeometry(string file){
   file = "";
   G4cout << "You need to compile Geant4 with GDML support to use this command" << G4endl;
 #endif
-
-
-
 }
 
diff --git a/NPSimulation/Core/EventAction.cc b/NPSimulation/Core/EventAction.cc
index 49a30ab8b6084e899752c59b23e6980f8d360a87..866f68c076cf3a820de00819beb79c1b88fa90a8 100644
--- a/NPSimulation/Core/EventAction.cc
+++ b/NPSimulation/Core/EventAction.cc
@@ -66,6 +66,7 @@ void EventAction::EndOfEventAction(const G4Event* event){
     if(treated%10000==0){
         tree->AutoSave();
         RootOutput::getInstance()->GetFile()->SaveSelf(kTRUE);
+        RootOutput::getInstance()->GetFile()->Purge();
     }
 }
 
diff --git a/NPSimulation/Core/ParticleStack.cc b/NPSimulation/Core/ParticleStack.cc
index 89656aa80668d96e1842297eaf64529a235efa0d..f7ca6d3bec6841bddca0c876e7566c93c16b9a54 100644
--- a/NPSimulation/Core/ParticleStack.cc
+++ b/NPSimulation/Core/ParticleStack.cc
@@ -53,6 +53,7 @@ ParticleStack::ParticleStack(){
     
     // Instantiate the TInitialConditions object and link it to the RootOutput tree
     m_InitialConditions = new TInitialConditions();
+    AttachInitialConditions();
     RootOutput::getInstance()->GetTree()->Branch("InitialConditions","TInitialConditions",&m_InitialConditions);
     
     m_EventZero = true;
@@ -65,6 +66,12 @@ ParticleStack::~ParticleStack(){
     
 }
 
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+void ParticleStack::AttachInitialConditions(){
+  RootOutput::getInstance()->GetTree()->Branch("InitialConditions","TInitialConditions",&m_InitialConditions);
+}
+
+
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 vector<Particle> ParticleStack::GetParticleStack(){
     return m_ParticleStack;
diff --git a/NPSimulation/Core/ParticleStack.hh b/NPSimulation/Core/ParticleStack.hh
index 5b0dd53ab1312152d30ef1e23f98fa25169298e8..d11d4a9bfa1248eecb8c6d3fa7657a4b0dc7b3b4 100644
--- a/NPSimulation/Core/ParticleStack.hh
+++ b/NPSimulation/Core/ParticleStack.hh
@@ -101,5 +101,9 @@ class ParticleStack{
 
     // Shoot everything in the stack at the end of the event
     void ShootAllParticle(G4Event* anEvent);
+   
+    // Attach the InitialConditions object to the tree
+    void AttachInitialConditions();
+
 };
 #endif
diff --git a/NPSimulation/Core/RunAction.cc b/NPSimulation/Core/RunAction.cc
index 4a8ebfa157cec2ec0a893ae853fba7bd21d7512c..8fcead843fd6d53efbaa4b50a86b293e6ccb4d46 100644
--- a/NPSimulation/Core/RunAction.cc
+++ b/NPSimulation/Core/RunAction.cc
@@ -31,7 +31,7 @@
 #include "RootOutput.h"
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 RunAction::RunAction(): G4UserRunAction(){
-    RootOutput::getInstance()->GetTree()->Branch("Run",&m_RunNumber,"Run/I");
+    RootOutput::getInstance()->GetTree()->Branch("Run",&m_RunNumber);
 }
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -40,6 +40,12 @@ RunAction::~RunAction(){
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 void RunAction::BeginOfRunAction(const G4Run* aRun){
+
+    cout << "Starting run " << aRun->GetRunID()+1;
+    // Replug the branch in case it no longer exist (e.g. reloading geometry) 
+    RootOutput::getInstance()->GetTree()->Branch("Run",&m_RunNumber);
+
+    // Increment the run number to be stored in the tree
     m_RunNumber = aRun->GetRunID()+1;
     
     //initialize event cumulative quantities
@@ -50,5 +56,7 @@ void RunAction::BeginOfRunAction(const G4Run* aRun){
 void RunAction::EndOfRunAction(const G4Run*){
     // Pass a line for nicer presentation when chainning event generator
     cout << endl;
+    
+    // Force the tree to be saved at the end of the run
+    RootOutput::getInstance()->GetTree()->AutoSave("Overwrite SaveSelf");
 }
-