Index: /trunk/BNC/bncmodel.cpp
===================================================================
--- /trunk/BNC/bncmodel.cpp	(revision 3381)
+++ /trunk/BNC/bncmodel.cpp	(revision 3382)
@@ -259,7 +259,7 @@
   _ellBanc.ReSize(3); _ellBanc = 0.0;
 
-  // Save for Outlier Detection
-  // --------------------------
-  _epoData_sav = 0;
+  // Save copy of data (used in outlier detection)
+  // ---------------------------------------------
+  _epoData_sav = new t_epoData();
 }
 
@@ -1374,6 +1374,5 @@
           else {
             if (nNeglected == 0) {
-              delete _epoData_sav;
-              _epoData_sav = new t_epoData(*epoData);
+              _epoData_sav->deepCopy(epoData);
             }
           }
@@ -1545,6 +1544,5 @@
   }
 
-  delete _epoData_sav;
-  _epoData_sav = new t_epoData(*epoData);
+  _epoData_sav->deepCopy(epoData);
 }
 
@@ -1568,24 +1566,5 @@
   }
 
-  epoData->tt = _epoData_sav->tt;
-  QMapIterator<QString, t_satData*> itGPS(_epoData_sav->satDataGPS);
-  while (itGPS.hasNext()) {
-    itGPS.next();
-    epoData->satDataGPS.remove(itGPS.key());
-    epoData->satDataGPS[itGPS.key()] = new t_satData(*itGPS.value());
-  }
-  QMapIterator<QString, t_satData*> itGlo(_epoData_sav->satDataGlo);
-  while (itGlo.hasNext()) {
-    itGlo.next();
-    epoData->satDataGlo.remove(itGlo.key());
-    epoData->satDataGlo[itGlo.key()] = new t_satData(*itGlo.value());
-  }
-  QMapIterator<QString, t_satData*> itGal(_epoData_sav->satDataGal);
-  while (itGal.hasNext()) {
-    itGal.next();
-    epoData->satDataGal.remove(itGal.key());
-    epoData->satDataGal[itGal.key()] = new t_satData(*itGal.value());
-  }
-
+  epoData->deepCopy(_epoData_sav);
 }
 
@@ -1595,4 +1574,6 @@
                           std::vector<QString>* allPrns) {
 
+  // GPS
+  // ---
   QMapIterator<QString, t_satData*> itGPS(epoData->satDataGPS);
   while (itGPS.hasNext()) {
Index: /trunk/BNC/bncpppclient.h
===================================================================
--- /trunk/BNC/bncpppclient.h	(revision 3381)
+++ /trunk/BNC/bncpppclient.h	(revision 3382)
@@ -66,17 +66,43 @@
   t_epoData() {}
 
-  t_epoData(const t_epoData& ed) {
-    tt = ed.tt;
-    QMapIterator<QString, t_satData*> itGPS(ed.satDataGPS);
+  ~t_epoData() {
+    clear();
+  }
+
+  void clear() {
+    QMapIterator<QString, t_satData*> itGPS(satDataGPS);
+    while (itGPS.hasNext()) {
+      itGPS.next();
+      delete itGPS.value();
+    }
+    satDataGPS.clear();
+    QMapIterator<QString, t_satData*> itGlo(satDataGlo);
+    while (itGlo.hasNext()) {
+      itGlo.next();
+      delete itGlo.value();
+    }
+    satDataGlo.clear();
+    QMapIterator<QString, t_satData*> itGal(satDataGal);
+    while (itGal.hasNext()) {
+      itGal.next();
+      delete itGal.value();
+    }
+    satDataGal.clear();
+  }
+
+  void deepCopy(const t_epoData* from) {
+    clear();
+    tt = from->tt;
+    QMapIterator<QString, t_satData*> itGPS(from->satDataGPS);
     while (itGPS.hasNext()) {
       itGPS.next();
       satDataGPS[itGPS.key()] = new t_satData(*itGPS.value());
     }
-    QMapIterator<QString, t_satData*> itGlo(ed.satDataGlo);
+    QMapIterator<QString, t_satData*> itGlo(from->satDataGlo);
     while (itGlo.hasNext()) {
       itGlo.next();
       satDataGlo[itGlo.key()] = new t_satData(*itGlo.value());
     }
-    QMapIterator<QString, t_satData*> itGal(ed.satDataGal);
+    QMapIterator<QString, t_satData*> itGal(from->satDataGal);
     while (itGal.hasNext()) {
       itGal.next();
@@ -85,21 +111,4 @@
   }
 
-  ~t_epoData() {
-    QMapIterator<QString, t_satData*> itGPS(satDataGPS);
-    while (itGPS.hasNext()) {
-      itGPS.next();
-      delete itGPS.value();
-    }
-    QMapIterator<QString, t_satData*> itGlo(satDataGlo);
-    while (itGlo.hasNext()) {
-      itGlo.next();
-      delete itGlo.value();
-    }
-    QMapIterator<QString, t_satData*> itGal(satDataGal);
-    while (itGal.hasNext()) {
-      itGal.next();
-      delete itGal.value();
-    }
-  }
   unsigned sizeGPS() const {return satDataGPS.size();}
   unsigned sizeGlo() const {return satDataGlo.size();}
