Index: trunk/BNC/src/PPP/pppClient.cpp
===================================================================
--- trunk/BNC/src/PPP/pppClient.cpp	(revision 10037)
+++ trunk/BNC/src/PPP/pppClient.cpp	(revision 10038)
@@ -155,5 +155,5 @@
   // -------
   epoTime.reset();
-  //clearObs();
+  clearObs();
 
   // Create vector of valid observations
@@ -636,9 +636,9 @@
       return finish(failure, 4);
     }
-    
+
       _offGlo = cmpOffGlo(_obsRover);
       _offGal = cmpOffGal(_obsRover);
       _offBds = cmpOffBds(_obsRover);
-      
+
     // Prepare Pseudo Observations of the Rover
     // ----------------------------------------
Index: trunk/BNC/src/bnccore.cpp
===================================================================
--- trunk/BNC/src/bnccore.cpp	(revision 10037)
+++ trunk/BNC/src/bnccore.cpp	(revision 10038)
@@ -759,5 +759,5 @@
 ////////////////////////////////////////////////////////////////////////////
 void t_bncCore::initCombination() {
-  _bncComb = new bncComb();
+  _bncComb = bncComb::instance();
   if (_bncComb->nStreams() < 1) {
     delete _bncComb;
Index: trunk/BNC/src/combination/bncbiassnx.cpp
===================================================================
--- trunk/BNC/src/combination/bncbiassnx.cpp	(revision 10037)
+++ trunk/BNC/src/combination/bncbiassnx.cpp	(revision 10038)
@@ -296,5 +296,6 @@
 //
 ////////////////////////////////////////////////////////////////////////////
-void bncBiasSnx::determineSsrSatCodeBiases(QString prn, double aIF1, double aIF2, t_satCodeBias& satCodeBias) {
+void bncBiasSnx::determineSsrSatCodeBiases(QString prn, double aIF1, double aIF2,
+                                           t_satCodeBias* satCodeBias) {
   std::string rnxType2ch;
   double value;
@@ -518,5 +519,6 @@
 
 
-void bncBiasSnx::setSsrSatCodeBias(std::string rnxType2ch, double value, t_satCodeBias& satCodeBias) {
+void bncBiasSnx::setSsrSatCodeBias(std::string rnxType2ch, double value,
+                                    t_satCodeBias* satCodeBias) {
   t_frqCodeBias frqCodeBias;
 
@@ -524,5 +526,5 @@
   frqCodeBias._value = value;
 
-  satCodeBias._bias.push_back(frqCodeBias);
+  satCodeBias->_bias.push_back(frqCodeBias);
   return;
 }
Index: trunk/BNC/src/combination/bncbiassnx.h
===================================================================
--- trunk/BNC/src/combination/bncbiassnx.h	(revision 10037)
+++ trunk/BNC/src/combination/bncbiassnx.h	(revision 10038)
@@ -59,6 +59,6 @@
   ~bncBiasSnx();
   t_irc readFile(const QString& fileName);
-  void determineSsrSatCodeBiases(QString prn, double aIF1, double aIF2, t_satCodeBias& satCodeBias);
-  void setSsrSatCodeBias(std::string rnxType2ch, double value, t_satCodeBias& satCodeBias);
+  void determineSsrSatCodeBiases(QString prn, double aIF1, double aIF2, t_satCodeBias* satCodeBias);
+  void setSsrSatCodeBias(std::string rnxType2ch, double value, t_satCodeBias* satCodeBias);
 
  private:
Index: trunk/BNC/src/combination/bnccomb.cpp
===================================================================
--- trunk/BNC/src/combination/bnccomb.cpp	(revision 10037)
+++ trunk/BNC/src/combination/bnccomb.cpp	(revision 10038)
@@ -114,9 +114,16 @@
 }
 
+
+// Define the static Singleton pointer
+////////////////////////////////////////////////////////////////////////////
+bncComb* bncComb::_instPtr = NULL;
+
 // Singleton
 ////////////////////////////////////////////////////////////////////////////
 bncComb* bncComb::instance() {
-  static bncComb _bncComb;
-  return &_bncComb;
+  if (_instPtr == NULL) {
+    _instPtr = new bncComb();
+  }
+  return(_instPtr);
 }
 
@@ -318,4 +325,5 @@
   delete _antex;
   delete _bsx;
+
   QMapIterator<char, unsigned> itSys(_cmbSysPrn);
   while (itSys.hasNext()) {
@@ -325,11 +333,10 @@
       delete _params[sys][iPar-1];
     }
-    QListIterator<bncTime> itTime(_buffer[sys].keys());
-    while (itTime.hasNext()) {
-      bncTime epoTime = itTime.next();
-      _buffer[sys].remove(epoTime);
-    }
-  }
-
+    _buffer.remove(sys);
+  }
+  while (!_epoClkData.empty()) {
+    delete _epoClkData.front();
+    _epoClkData.pop_front();
+  }
 }
 
@@ -389,6 +396,9 @@
     // Store the correction
     // --------------------
-    QMap<t_prn, t_orbCorr>& storage = _orbCorrections[acName];
-    storage[orbCorr._prn] = orbCorr;
+    QMap<t_prn, t_orbCorr*>& storage = _orbCorrections[acName];
+    if (storage[orbCorr._prn]) {
+      delete  storage[orbCorr._prn];
+    }
+    storage[orbCorr._prn] = new t_orbCorr(orbCorr);
   }
 }
@@ -425,6 +435,9 @@
     // Store the correction
     // --------------------
-    QMap<t_prn, t_satCodeBias>& storage = _satCodeBiases[acName];
-    storage[satCodeBias._prn] = satCodeBias;
+    QMap<t_prn, t_satCodeBias*>& storage = _satCodeBiases[acName];
+    if (storage[satCodeBias._prn]) {
+      delete storage[satCodeBias._prn];
+    }
+    storage[satCodeBias._prn] = new t_satCodeBias(satCodeBias);
   }
 }
@@ -434,14 +447,39 @@
 void bncComb::slotNewClkCorrections(QList<t_clkCorr> clkCorrections) {
   QMutexLocker locker(&_mutex);
-
-  bncTime lastTime;
-
+  const double outWait = 1.0 * _cmbSampl;
+
+  // Loop over all observations (possible different epochs)
+  // -----------------------------------------------------
   for (int ii = 0; ii < clkCorrections.size(); ii++) {
-    t_clkCorr& clkCorr = clkCorrections[ii];
-    QString    staID(clkCorr._staID.c_str());
-    QString    prn(clkCorr._prn.toInternalString().c_str());
-    char       sys = clkCorr._prn.system();
-
+    t_clkCorr* newClk = new t_clkCorr(clkCorrections[ii]);
+
+    char sys = newClk->_prn.system();
     if (!_cmbSysPrn.contains(sys)){
+      delete newClk;
+      continue;
+    }
+
+    // Check Modulo Time
+    // -----------------
+    int sec = int(nint(newClk->_time.gpssec()*10));
+    if (sec % (_cmbSampl*10) != 0.0) {
+      delete newClk;
+      continue;
+    }
+
+    // Find/Check the AC Name
+    // ----------------------
+    QString acName;
+    QString staID(newClk->_staID.c_str());
+    QListIterator<cmbAC*> icAC(_ACs);
+    while (icAC.hasNext()) {
+      cmbAC* AC = icAC.next();
+      if (AC->mountPoint == staID) {
+        acName = AC->name;
+        break;
+      }
+    }
+    if (acName.isEmpty()) {
+      delete newClk;
       continue;
     }
@@ -449,7 +487,133 @@
     // Set the last time
     // -----------------
-    if (lastTime.undef() || clkCorr._time > lastTime) {
-      lastTime = clkCorr._time;
-    }
+    if (_lastClkCorrTime.undef() || newClk->_time > _lastClkCorrTime) {
+      _lastClkCorrTime = newClk->_time;
+    }
+
+    // Check Correction Age
+    // --------------------
+    //if (_lastEpoTimeOK.valid() && newClk->_time <= _lastEpoTimeOK) {
+    if (_lastClkCorrTime.valid() && newClk->_time < _lastClkCorrTime) {
+      emit newMessage("bncComb: old correction: " + acName.toLatin1() + " " + newClk->_prn.toString().c_str() +
+                       //QString(" %1 ").arg(_lastEpoTimeOK.timestr().c_str()).toLatin1() + "vs. old" +
+                       QString(" %1 ").arg(_lastClkCorrTime.timestr().c_str()).toLatin1() + "vs. old" +
+                       QString(" %1 ").arg(newClk->_time.timestr().c_str()).toLatin1(), true);
+      delete newClk;
+      continue;
+    }
+
+    // Find the corresponding data epoch or create a new one
+    // -----------------------------------------------------
+    epoClkData* epoch = 0;
+    deque<epoClkData*>::const_iterator it;
+    for (it = _epoClkData.begin(); it != _epoClkData.end(); it++) {
+      if (newClk->_time == (*it)->_time) {
+      epoch = *it;
+        break;
+      }
+    }
+    if (epoch == 0) {
+      if (_epoClkData.empty() || newClk->_time > _epoClkData.back()->_time) {
+        epoch = new epoClkData;
+        epoch->_time = newClk->_time;
+        _epoClkData.push_back(epoch);
+      }
+    }
+
+    // Put data into the epoch
+    // -----------------------
+    if (epoch != 0) {
+      epoch->_clkCorr.push_back(newClk);
+    }
+    else {
+      delete newClk;
+    }
+  }
+
+  // Make sure the buffer does not grow beyond any limit
+  // ---------------------------------------------------
+  const unsigned MAX_EPODATA_SIZE = 10;
+  if (_epoClkData.size() > MAX_EPODATA_SIZE) {
+    delete _epoClkData.front();
+    _epoClkData.pop_front();
+  }
+
+  // Process the oldest epochs
+  // ------------------------
+  while (_epoClkData.size()) {
+
+    if(!_lastClkCorrTime.valid()) {
+      return;
+    }
+
+    const vector<t_clkCorr*>& clkCorrVec = _epoClkData.front()->_clkCorr;
+
+    bncTime epoTime = _epoClkData.front()->_time;
+
+    // Process the front epoch
+    // -----------------------
+    if (epoTime < (_lastClkCorrTime - outWait)) {
+      processEpoch(epoTime, clkCorrVec);
+      delete _epoClkData.front();
+      _epoClkData.pop_front();
+    }
+    else {
+      return;
+    }
+  }
+}
+
+// Change the correction so that it refers to last received ephemeris
+////////////////////////////////////////////////////////////////////////////
+void bncComb::switchToLastEph(t_eph* lastEph, cmbCorr* corr) {
+
+  if (corr->_eph == lastEph) {
+    return;
+  }
+
+  ColumnVector oldXC(6);
+  ColumnVector oldVV(3);
+  if (corr->_eph->getCrd(corr->_time, oldXC, oldVV, false) != success) {
+    return;
+  }
+
+  ColumnVector newXC(6);
+  ColumnVector newVV(3);
+  if (lastEph->getCrd(corr->_time, newXC, newVV, false) != success) {
+    return;
+  }
+
+  ColumnVector dX = newXC.Rows(1,3) - oldXC.Rows(1,3);
+  ColumnVector dV = newVV           - oldVV;
+  double       dC = newXC(4)        - oldXC(4);
+
+  ColumnVector dRAO(3);
+  XYZ_to_RSW(newXC.Rows(1,3), newVV, dX, dRAO);
+
+  ColumnVector dDotRAO(3);
+  XYZ_to_RSW(newXC.Rows(1,3), newVV, dV, dDotRAO);
+
+  QString msg = "switch corr " + corr->_prn.mid(0,3)
+    + QString(" %1 -> %2 %3").arg(corr->_iod,3).arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4);
+
+  emit newMessage(msg.toLatin1(), false);
+
+  corr->_iod = lastEph->IOD();
+  corr->_eph = lastEph;
+
+  corr->_orbCorr->_xr    += dRAO;
+  corr->_orbCorr->_dotXr += dDotRAO;
+  corr->_clkCorr->_dClk  -= dC;
+}
+
+// Process Epoch
+////////////////////////////////////////////////////////////////////////////
+void bncComb::processEpoch(bncTime epoTime, const vector<t_clkCorr*>& clkCorrVec) {
+
+  for (unsigned ii = 0; ii < clkCorrVec.size(); ii++) {
+    const t_clkCorr* clkCorr = clkCorrVec.at(ii);
+    QString    staID(clkCorr->_staID.c_str());
+    QString    prn(clkCorr->_prn.toInternalString().c_str());
+    char       sys = clkCorr->_prn.system();
 
     // Find/Check the AC Name
@@ -466,33 +630,14 @@
       }
     }
-    if (acName.isEmpty()) {
-      continue;
-    }
-
-    // Check Modulo Time
-    // -----------------
-    int sec = int(nint(clkCorr._time.gpssec()*10));
-    if (sec % (_cmbSampl*10) != 0.0) {
-      continue;
-    }
-
-    // Check Correction Age
-    // --------------------
-    if (_resTime.valid() && clkCorr._time <= _resTime) {
-      emit newMessage("bncComb: old correction: " + acName.toLatin1() + " " + prn.mid(0,3).toLatin1() +
-                       QString("%1").arg(_resTime.timestr().c_str()).toLatin1() + " vs. old " +
-                       QString("%1").arg(clkCorr._time.timestr().c_str()).toLatin1(), true);
-      continue;
-    }
 
     // Create new correction
     // ---------------------
-    cmbCorr* newCorr  = new cmbCorr();
-    newCorr->_prn     = prn;
-    newCorr->_time    = clkCorr._time;
-    newCorr->_iod     = clkCorr._iod;
-    newCorr->_acName  = acName;
-    newCorr->_clkCorr = clkCorr;
+    cmbCorr* newCorr       = new cmbCorr();
+    newCorr->_prn          = prn;
+    newCorr->_time         = clkCorr->_time;
+    newCorr->_iod          = clkCorr->_iod;
+    newCorr->_acName       = acName;
     newCorr->_weightFactor = weigthFactor;
+    newCorr->_clkCorr = new t_clkCorr(*clkCorrVec[ii]);
 
     // Check orbit correction
@@ -503,12 +648,12 @@
     }
     else {
-      QMap<t_prn, t_orbCorr>& storage = _orbCorrections[acName];
-      if (!storage.contains(clkCorr._prn)  ||
-           storage[clkCorr._prn]._iod != newCorr->_iod) {
+      QMap<t_prn, t_orbCorr*>& storage = _orbCorrections[acName];
+      if (!storage.contains(clkCorr->_prn)  ||
+           storage[clkCorr->_prn]->_iod != newCorr->_iod) {
         delete newCorr;
         continue;
       }
       else {
-        newCorr->_orbCorr = storage[clkCorr._prn];
+        newCorr->_orbCorr = storage[clkCorr->_prn];
       }
     }
@@ -556,15 +701,15 @@
     // ----------------------------
     if (_satCodeBiases.contains(acName)) {
-      QMap<t_prn, t_satCodeBias>& storage = _satCodeBiases[acName];
-      if (storage.contains(clkCorr._prn)) {
-        newCorr->_satCodeBias = storage[clkCorr._prn];
+      QMap<t_prn, t_satCodeBias*>& storage = _satCodeBiases[acName];
+      if (storage.contains(clkCorr->_prn)) {
+        newCorr->_satCodeBias = storage[clkCorr->_prn];
         QMap<t_frequency::type, double> codeBiasesRefSig;
         for (unsigned ii = 1; ii < cmbRefSig::cIF; ii++) {
-          t_frequency::type frqType = cmbRefSig::toFreq(sys,  static_cast<cmbRefSig::type>(ii));
+          t_frequency::type frqType = cmbRefSig::toFreq(sys, static_cast<cmbRefSig::type>(ii));
           char frqNum = t_frequency::toString(frqType)[1];
-          char attrib = cmbRefSig::toAttrib(sys,  static_cast<cmbRefSig::type>(ii));
+          char attrib = cmbRefSig::toAttrib(sys, static_cast<cmbRefSig::type>(ii));
           QString rnxType2ch = QString("%1%2").arg(frqNum).arg(attrib);
-          for (unsigned ii = 0; ii < newCorr->_satCodeBias._bias.size(); ii++) {
-            const t_frqCodeBias& bias = newCorr->_satCodeBias._bias[ii];
+          for (unsigned ii = 0; ii < newCorr->_satCodeBias->_bias.size(); ii++) {
+            const t_frqCodeBias& bias = newCorr->_satCodeBias->_bias[ii];
             if (rnxType2ch.toStdString() == bias._rnxType2ch) {
               codeBiasesRefSig[frqType] = bias._value;
@@ -582,5 +727,5 @@
           }
         }
-        newCorr->_satCodeBias._bias.clear();
+        newCorr->_satCodeBias->_bias.clear();
       }
     }
@@ -588,76 +733,39 @@
     // Store correction into the buffer
     // --------------------------------
-    QVector<cmbCorr*>& corrs = _buffer[sys][newCorr->_time].corrs;
-    corrs.push_back(newCorr);
-  }
-
-  // Process previous Epoch(s)
-  // -------------------------
-  const double outWait = 1.0 * _cmbSampl;
+    QVector<cmbCorr*>& corrs = _buffer[sys].corrs;
+
+    QVectorIterator<cmbCorr*> itCorr(corrs);
+    bool available = false;
+    while (itCorr.hasNext()) {
+      cmbCorr* corr = itCorr.next();
+      QString  prn  = corr->_prn;
+      QString  acName = corr->_acName;
+      if (newCorr->_acName == acName && newCorr->_prn == prn) {
+        available = true;
+      }
+    }
+    if (!available) {
+      corrs.push_back(newCorr);
+    }
+    else {
+      delete newCorr;
+      continue;
+    }
+  }
+
+  // Process Systems of this Epoch
+  // ------------------------------
   QMapIterator<char, unsigned> itSys(_cmbSysPrn);
   while (itSys.hasNext()) {
     itSys.next();
     char sys = itSys.key();
-    QListIterator<bncTime> itTime(_buffer[sys].keys());
-    while (itTime.hasNext()) {
-      bncTime epoTime = itTime.next();
-      if (epoTime < lastTime - outWait) {
-        _resTime = epoTime;
-        processEpoch(sys);
-      }
-    }
-  }
-}
-
-// Change the correction so that it refers to last received ephemeris
-////////////////////////////////////////////////////////////////////////////
-void bncComb::switchToLastEph(t_eph* lastEph, cmbCorr* corr) {
-
-  if (corr->_eph == lastEph) {
-    return;
-  }
-
-  ColumnVector oldXC(6);
-  ColumnVector oldVV(3);
-  if (corr->_eph->getCrd(corr->_time, oldXC, oldVV, false) != success) {
-    return;
-  }
-
-  ColumnVector newXC(6);
-  ColumnVector newVV(3);
-  if (lastEph->getCrd(corr->_time, newXC, newVV, false) != success) {
-    return;
-  }
-
-  ColumnVector dX = newXC.Rows(1,3) - oldXC.Rows(1,3);
-  ColumnVector dV = newVV           - oldVV;
-  double       dC = newXC(4)        - oldXC(4);
-
-  ColumnVector dRAO(3);
-  XYZ_to_RSW(newXC.Rows(1,3), newVV, dX, dRAO);
-
-  ColumnVector dDotRAO(3);
-  XYZ_to_RSW(newXC.Rows(1,3), newVV, dV, dDotRAO);
-
-  QString msg = "switch corr " + corr->_prn.mid(0,3)
-    + QString(" %1 -> %2 %3").arg(corr->_iod,3).arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4);
-
-  emit newMessage(msg.toLatin1(), false);
-
-  corr->_iod = lastEph->IOD();
-  corr->_eph = lastEph;
-
-  corr->_orbCorr._xr    += dRAO;
-  corr->_orbCorr._dotXr += dDotRAO;
-  corr->_clkCorr._dClk  -= dC;
-}
-
-// Process Epoch
-////////////////////////////////////////////////////////////////////////////
-void bncComb::processEpoch(char sys) {
-
-  _log.clear();
-
-  QTextStream out(&_log, QIODevice::WriteOnly);
+    _log.clear();
+    QTextStream out(&_log, QIODevice::WriteOnly);
+    processSystem(epoTime, sys, out);
+    emit newMessage(_log, false);
+  }
+}
+
+void bncComb::processSystem(bncTime epoTime, char sys, QTextStream& out) {
 
   out << "\n" <<           "Combination: " << sys << "\n"
@@ -694,5 +802,5 @@
     if (_masterMissingEpochs[sys] < switchMasterAfterGap) {
       out << "Missing Master, Epoch skipped" << "\n";
-      _buffer[sys].remove(_resTime);
+      _buffer.remove(sys);
       emit newMessage(_log, false);
       return;
@@ -707,6 +815,6 @@
               << _masterOrbitAC[sys].toLatin1().data() << " --> "
               << AC->name.toLatin1().data()   << " "
-              << _resTime.datestr().c_str()    << " "
-              << _resTime.timestr().c_str()    << "\n";
+              << epoTime.datestr().c_str()    << " "
+              << epoTime.timestr().c_str()    << "\n";
           _masterOrbitAC[sys] = AC->name;
           break;
@@ -723,8 +831,8 @@
   ColumnVector dx;
   if (_method == filter) {
-    irc = processEpoch_filter(sys, out, resCorr, dx);
+    irc = processEpoch_filter(epoTime, sys, out, resCorr, dx);
   }
   else {
-    irc = processEpoch_singleEpoch(sys, out, resCorr, dx);
+    irc = processEpoch_singleEpoch(epoTime, sys, out, resCorr, dx);
   }
 
@@ -746,10 +854,13 @@
             t_frequency::type fType1 = cmbRefSig::toFreq(sys, cmbRefSig::c1);
             t_frequency::type fType2 = cmbRefSig::toFreq(sys, cmbRefSig::c2);
+            if (resCorr[pp->prn]->_satCodeBias == 0) {
+              resCorr[pp->prn]->_satCodeBias = new t_satCodeBias();
+            }
             _bsx->determineSsrSatCodeBiases(pp->prn.mid(0,3), codeCoeff[fType1], codeCoeff[fType2], resCorr[pp->prn]->_satCodeBias);
           }
         }
       }
-      out << _resTime.datestr().c_str() << " "
-          << _resTime.timestr().c_str() << " ";
+      out << epoTime.datestr().c_str() << " "
+          << epoTime.timestr().c_str() << " ";
       out.setRealNumberNotation(QTextStream::FixedNotation);
       out.setFieldWidth(8);
@@ -759,17 +870,15 @@
       out.setFieldWidth(0);
     }
-    printResults(out, resCorr);
-    dumpResults(resCorr);
-  }
-
-  // Delete Data, emit Message
-  // -------------------------
-  _buffer[sys].remove(_resTime);
-  emit newMessage(_log, false);
+    printResults(epoTime, out, resCorr);
+    dumpResults(epoTime, resCorr);
+  }
+  // Delete Data
+  // -----------
+  _buffer.remove(sys);
 }
 
 // Process Epoch - Filter Method
 ////////////////////////////////////////////////////////////////////////////
-t_irc bncComb::processEpoch_filter(char sys, QTextStream& out,
+t_irc bncComb::processEpoch_filter(bncTime epoTime, char sys, QTextStream& out,
                                    QMap<QString, cmbCorr*>& resCorr,
                                    ColumnVector& dx) {
@@ -795,5 +904,5 @@
   // Check Satellite Positions for Outliers
   // --------------------------------------
-  if (checkOrbits(sys, out) != success) {
+  if (checkOrbits(epoTime, sys, out) != success) {
     return failure;
   }
@@ -821,5 +930,5 @@
     out.setRealNumberNotation(QTextStream::FixedNotation);
     out.setRealNumberPrecision(3);
-    out << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str()
+    out << epoTime.datestr().c_str() << " " << epoTime.timestr().c_str()
         << " Maximum Residuum " << maxRes << ' '
         << corrs(sys)[maxResIndex-1]->_acName << ' ' << corrs(sys)[maxResIndex-1]->_prn.mid(0,3);
@@ -846,6 +955,6 @@
       for (int ii = 0; ii < corrs(sys).size(); ii++) {
       const cmbCorr* corr = corrs(sys)[ii];
-        out << _resTime.datestr().c_str() << ' '
-            << _resTime.timestr().c_str() << " "
+        out << epoTime.datestr().c_str() << ' '
+            << epoTime.timestr().c_str() << " "
             << corr->_acName << ' ' << corr->_prn.mid(0,3);
         out.setFieldWidth(10);
@@ -862,5 +971,5 @@
 // Print results
 ////////////////////////////////////////////////////////////////////////////
-void bncComb::printResults(QTextStream& out,
+void bncComb::printResults(bncTime epoTime, QTextStream& out,
                            const QMap<QString, cmbCorr*>& resCorr) {
 
@@ -873,9 +982,9 @@
       ColumnVector xc(6);
       ColumnVector vv(3);
-      if (eph->getCrd(_resTime, xc, vv, false) != success) {
+      if (eph->getCrd(epoTime, xc, vv, false) != success) {
         continue;
       }
-      out << _resTime.datestr().c_str() << " "
-          << _resTime.timestr().c_str() << " ";
+      out << epoTime.datestr().c_str() << " "
+          << epoTime.timestr().c_str() << " ";
       out.setFieldWidth(3);
       out << "Full Clock " << corr->_prn.mid(0,3) << " " << corr->_iod << " ";
@@ -893,5 +1002,5 @@
 // Send results to RTNet Decoder and directly to PPP Client
 ////////////////////////////////////////////////////////////////////////////
-void bncComb::dumpResults(const QMap<QString, cmbCorr*>& resCorr) {
+void bncComb::dumpResults(bncTime epoTime, const QMap<QString, cmbCorr*>& resCorr) {
 
   QList<t_orbCorr> orbCorrections;
@@ -901,6 +1010,6 @@
   unsigned year, month, day, hour, minute;
   double   sec;
-  _resTime.civil_date(year, month, day);
-  _resTime.civil_time(hour, minute, sec);
+  epoTime.civil_date(year, month, day);
+  epoTime.civil_time(hour, minute, sec);
 
   QString outLines = QString().asprintf("*  %4d %2d %2d %d %d %12.8f\n",
@@ -911,10 +1020,12 @@
     it.next();
     cmbCorr* corr = it.value();
+
     // ORBIT
-    t_orbCorr orbCorr(corr->_orbCorr);
+    t_orbCorr orbCorr(static_cast<t_orbCorr>(*corr->_orbCorr));
     orbCorr._staID = "INTERNAL";
     orbCorrections.push_back(orbCorr);
+
     // CLOCK
-    t_clkCorr clkCorr(corr->_clkCorr);
+    t_clkCorr clkCorr(static_cast<t_clkCorr>(*corr->_clkCorr));
     clkCorr._staID      = "INTERNAL";
     clkCorr._dClk       = corr->_dClkResult;
@@ -922,6 +1033,7 @@
     clkCorr._dotDotDClk = 0.0;
     clkCorrections.push_back(clkCorr);
+
     // CODE BIASES
-    t_satCodeBias satCodeBias(corr->_satCodeBias);
+    t_satCodeBias satCodeBias(static_cast<t_satCodeBias>(*corr->_satCodeBias));
     satCodeBias._staID = "INTERNAL";
     satCodeBiasList.push_back(satCodeBias);
@@ -931,5 +1043,5 @@
     corr->_eph->setClkCorr(dynamic_cast<const t_clkCorr*>(&clkCorr));
     corr->_eph->setOrbCorr(dynamic_cast<const t_orbCorr*>(&orbCorr));
-    if (corr->_eph->getCrd(_resTime, xc, vv, true) != success) {
+    if (corr->_eph->getCrd(epoTime, xc, vv, true) != success) {
       delete corr;
       continue;
@@ -940,5 +1052,5 @@
     ColumnVector dx(3); dx = 0.0;
     if (_antex) {
-      double Mjd = _resTime.mjd() + _resTime.daysec()/86400.0;
+      double Mjd = epoTime.mjd() + epoTime.daysec()/86400.0;
       if (_antex->satCoMcorrection(corr->_prn, Mjd, xc.Rows(1,3), dx) != success) {
         dx = 0;
@@ -1034,5 +1146,5 @@
     }
 
-    ll(iObs) = (corr->_clkCorr._dClk * t_CST::c - corr->_satCodeBiasIF) - DotProduct(AA.Row(iObs), x0);
+    ll(iObs) = (corr->_clkCorr->_dClk * t_CST::c - corr->_satCodeBiasIF) - DotProduct(AA.Row(iObs), x0);
 
     PP(iObs, iObs) *= 1.0 / (corr->_weightFactor * corr->_weightFactor);
@@ -1081,5 +1193,5 @@
 // Process Epoch - Single-Epoch Method
 ////////////////////////////////////////////////////////////////////////////
-t_irc bncComb::processEpoch_singleEpoch(char sys, QTextStream& out,
+t_irc bncComb::processEpoch_singleEpoch(bncTime epoTime, char sys, QTextStream& out,
                                         QMap<QString, cmbCorr*>& resCorr,
                                         ColumnVector& dx) {
@@ -1087,5 +1199,5 @@
   // Check Satellite Positions for Outliers
   // --------------------------------------
-  if (checkOrbits(sys, out) != success) {
+  if (checkOrbits(epoTime, sys, out) != success) {
     return failure;
   }
@@ -1203,5 +1315,5 @@
     out.setRealNumberNotation(QTextStream::FixedNotation);
     out.setRealNumberPrecision(3);
-    out << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str()
+    out << epoTime.datestr().c_str() << " " << epoTime.timestr().c_str()
         << " Maximum Residuum " << maxRes << ' '
         << corrs(sys)[maxResIndex-1]->_acName << ' ' << corrs(sys)[maxResIndex-1]->_prn.mid(0,3);
@@ -1218,6 +1330,6 @@
       for (int ii = 0; ii < vv.Nrows(); ii++) {
         const cmbCorr* corr = corrs(sys)[ii];
-        out << _resTime.datestr().c_str() << ' '
-            << _resTime.timestr().c_str() << " "
+        out << epoTime.datestr().c_str() << ' '
+            << epoTime.timestr().c_str() << " "
             << corr->_acName << ' ' << corr->_prn.mid(0,3);
         out.setFieldWidth(6);
@@ -1235,5 +1347,5 @@
 // Check Satellite Positions for Outliers
 ////////////////////////////////////////////////////////////////////////////
-t_irc bncComb::checkOrbits(char sys, QTextStream& out) {
+t_irc bncComb::checkOrbits(bncTime epoTime, char sys, QTextStream& out) {
 
   const double MAX_DISPLACEMENT = 0.20;
@@ -1283,9 +1395,9 @@
       if (meanRao.find(prn) == meanRao.end()) {
         meanRao[prn].ReSize(4);
-        meanRao[prn].Rows(1,3) = corr->_orbCorr._xr;
+        meanRao[prn].Rows(1,3) = corr->_orbCorr->_xr;
         meanRao[prn](4)        = 1;
       }
       else {
-        meanRao[prn].Rows(1,3) += corr->_orbCorr._xr;
+        meanRao[prn].Rows(1,3) += corr->_orbCorr->_xr;
         meanRao[prn](4)        += 1;
       }
@@ -1309,5 +1421,5 @@
         meanRao[prn](4) = 0;
       }
-      corr->_diffRao = corr->_orbCorr._xr - meanRao[prn].Rows(1,3);
+      corr->_diffRao = corr->_orbCorr->_xr - meanRao[prn].Rows(1,3);
       if (maxDiff.find(prn) == maxDiff.end()) {
         maxDiff[prn] = corr;
@@ -1340,6 +1452,6 @@
         double norm = corr->_diffRao.NormFrobenius();
         if (norm > MAX_DISPLACEMENT) {
-          out << _resTime.datestr().c_str()    << " "
-              << _resTime.timestr().c_str()    << " "
+          out << epoTime.datestr().c_str()    << " "
+              << epoTime.timestr().c_str()    << " "
               << "Orbit Outlier: "
               << corr->_acName.toLatin1().data() << " "
@@ -1374,10 +1486,10 @@
   QListIterator<cmbAC*> icAC(_ACs);
   while (icAC.hasNext()) {
-    cmbAC* AC = icAC.next();
+    cmbAC *AC = icAC.next();
     if (AC->mountPoint == mountPoint) {
       acName = AC->name;
-      out << "Provider ID changed: AC " << AC->name.toLatin1().data()   << " "
-          << _resTime.datestr().c_str()    << " "
-          << _resTime.timestr().c_str()    << "\n";
+      out << "Provider ID changed: AC " << AC->name.toLatin1().data() << " "
+//          << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str()
+          << "\n";
       break;
     }
@@ -1392,28 +1504,23 @@
     // Remove all corrections of the corresponding AC
     // ----------------------------------------------
-    QListIterator<bncTime> itTime(_buffer[sys].keys());
-    while (itTime.hasNext()) {
-      bncTime epoTime = itTime.next();
-      QVector<cmbCorr*>& corrVec = _buffer[sys][epoTime].corrs;
-      QMutableVectorIterator<cmbCorr*> it(corrVec);
-      while (it.hasNext()) {
-        cmbCorr* corr = it.next();
-        if (acName == corr->_acName) {
-          delete corr;
-          it.remove();
-        }
-      }
-    }
-
+    QVector<cmbCorr*> &corrVec = _buffer[sys].corrs;
+    QMutableVectorIterator<cmbCorr*> it(corrVec);
+    while (it.hasNext()) {
+      cmbCorr *corr = it.next();
+      if (acName == corr->_acName) {
+        delete corr;
+        it.remove();
+      }
+    }
     // Reset Satellite Offsets
     // -----------------------
     if (_method == filter) {
       for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
-        cmbParam* pp = _params[sys][iPar-1];
+        cmbParam *pp = _params[sys][iPar - 1];
         if (pp->AC == acName && pp->type == cmbParam::offACSat) {
           pp->xx = 0.0;
-          _QQ[sys].Row(iPar)    = 0.0;
+          _QQ[sys].Row(iPar) = 0.0;
           _QQ[sys].Column(iPar) = 0.0;
-          _QQ[sys](iPar,iPar) = pp->sig0 * pp->sig0;
+          _QQ[sys](iPar, iPar) = pp->sig0 * pp->sig0;
         }
       }
Index: trunk/BNC/src/combination/bnccomb.h
===================================================================
--- trunk/BNC/src/combination/bnccomb.h	(revision 10037)
+++ trunk/BNC/src/combination/bnccomb.h	(revision 10038)
@@ -4,6 +4,8 @@
 
 #include <fstream>
+#include <iostream>
 #include <map>
 #include <newmat.h>
+#include <deque>
 #include "bncephuser.h"
 #include "satObs.h"
@@ -20,5 +22,4 @@
  Q_OBJECT
  public:
-  bncComb();
   virtual ~bncComb();
   static bncComb* instance();
@@ -42,4 +43,9 @@
 
  private:
+  static bncComb* _instPtr;   // The one, single instance
+  bncComb();                  // private constructor
+  bncComb(const bncComb&);
+  bncComb& operator=(const bncComb&);
+
   enum e_method{singleEpoch, filter};
 
@@ -85,7 +91,11 @@
     cmbCorr() {
       _eph                        = 0;
+      _orbCorr                    = 0;
+      _clkCorr                    = 0;
+      _satCodeBias                = 0;
       _iod                        = 0;
       _dClkResult                 = 0.0;
       _satCodeBiasIF              = 0.0;
+      _weightFactor               = 1.0;
     }
     ~cmbCorr() {}
@@ -94,7 +104,7 @@
     unsigned long  _iod;
     t_eph*         _eph;
-    t_orbCorr      _orbCorr;
-    t_clkCorr      _clkCorr;
-    t_satCodeBias  _satCodeBias;
+    t_orbCorr*      _orbCorr;
+    t_clkCorr*      _clkCorr;
+    t_satCodeBias* _satCodeBias;
     QString        _acName;
     double         _satCodeBiasIF;
@@ -109,4 +119,7 @@
     cmbEpoch() {}
     ~cmbEpoch() {
+      clear();
+    }
+    void clear() {
       QVectorIterator<cmbCorr*> it(corrs);
       while (it.hasNext()) {
@@ -115,4 +128,16 @@
     }
     QVector<cmbCorr*> corrs;
+  };
+
+  class epoClkData {
+   public:
+    epoClkData() {}
+    ~epoClkData() {
+      for (unsigned ii = 0; ii < _clkCorr.size(); ii++) {
+        delete _clkCorr[ii];
+      }
+    }
+    bncTime                 _time;
+    std::vector<t_clkCorr*> _clkCorr;
   };
 
@@ -196,23 +221,22 @@
   };
 
-
-  void  processEpoch(char sys);
-  t_irc processEpoch_filter(char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr,
-                            ColumnVector& dx);
-  t_irc processEpoch_singleEpoch(char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr,
-                                 ColumnVector& dx);
+  void  processEpoch(bncTime epoTime, const std::vector<t_clkCorr*>& clkCorrVec);
+  void  processSystem(bncTime epoTime, char sys, QTextStream& out);
+  t_irc processEpoch_filter(bncTime epoTime, char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr, ColumnVector& dx);
+  t_irc processEpoch_singleEpoch(bncTime epoTime, char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr, ColumnVector& dx);
   t_irc createAmat(char sys, Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,
                    const ColumnVector& x0, QMap<QString, cmbCorr*>& resCorr);
-  void  dumpResults(const QMap<QString, cmbCorr*>& resCorr);
-  void  printResults(QTextStream& out, const QMap<QString, cmbCorr*>& resCorr);
+  void  dumpResults(bncTime epoTime, const QMap<QString, cmbCorr*>& resCorr);
+  void  printResults(bncTime epoTime, QTextStream& out, const QMap<QString, cmbCorr*>& resCorr);
   void  switchToLastEph(t_eph* lastEph, cmbCorr* corr);
-  t_irc checkOrbits(char sys, QTextStream& out);
-  QVector<cmbCorr*>& corrs(char sys) {return _buffer[sys][_resTime].corrs;}
+  t_irc checkOrbits(bncTime epoTime, char sys, QTextStream& out);
+  QVector<cmbCorr*>& corrs(char sys) {return _buffer[sys].corrs;}
 
   QMutex                                     _mutex;
   QList<cmbAC*>                              _ACs;
-  bncTime                                    _resTime;
+  std::deque<epoClkData*>                    _epoClkData;
+  bncTime                                    _lastClkCorrTime;
   QMap<char, QVector<cmbParam*>>             _params;
-  QMap<char, QMap<bncTime, cmbEpoch>>        _buffer;
+  QMap<char, cmbEpoch>                       _buffer;
   bncRtnetDecoder*                           _rtnetDecoder;
   QMap<char, SymmetricMatrix>                _QQ;
@@ -227,6 +251,6 @@
   int                                        _ms;
   QString                                    _cmbRefAttributes;
-  QMap<QString, QMap<t_prn, t_orbCorr> >     _orbCorrections;
-  QMap<QString, QMap<t_prn, t_satCodeBias> > _satCodeBiases;
+  QMap<QString, QMap<t_prn, t_orbCorr*> >     _orbCorrections;
+  QMap<QString, QMap<t_prn, t_satCodeBias*> > _satCodeBiases;
   bncEphUser                                 _ephUser;
   SsrCorr*                                   _ssrCorr;
Index: trunk/BNC/src/satObs.h
===================================================================
--- trunk/BNC/src/satObs.h	(revision 10037)
+++ trunk/BNC/src/satObs.h	(revision 10038)
@@ -49,5 +49,7 @@
 class t_satObs {
  public:
-  t_satObs() {}
+  t_satObs() {
+    _type = 0;
+  }
   t_satObs(const t_satObs& old) { // copy constructor (deep copy)
     _staID = old._staID;
@@ -62,6 +64,5 @@
    * Destructor of satellite measurement storage class
    */
-  ~t_satObs()
-  {
+  ~t_satObs() {
     clear();
   }
@@ -70,6 +71,5 @@
    * Cleanup function resets all elements to initial state.
    */
-  inline void clear(void)
-  {
+  inline void clear(void) {
     for (unsigned ii = 0; ii < _obs.size(); ii++)
       delete _obs[ii];
@@ -92,4 +92,14 @@
  public:
   t_orbCorr();
+  t_orbCorr(const t_orbCorr& old) { // copy constructor (deep copy)
+    _staID      = old._staID;
+    _prn        = old._prn;
+    _iod        = old._iod;
+    _time       = old._time;
+    _updateInt  = old._updateInt;
+    _system     = old._system;
+    _xr         = old._xr;
+    _dotXr      = old._dotXr;
+  }
   static void writeEpoch(std::ostream* out, const QList<t_orbCorr>& corrList);
   static void readEpoch(const std::string& epoLine, std::istream& in, QList<t_orbCorr>& corrList);
@@ -107,4 +117,14 @@
  public:
   t_clkCorr();
+  t_clkCorr(const t_clkCorr& old) { // copy constructor (deep copy)
+    _staID      = old._staID;
+    _prn        = old._prn;
+    _iod        = old._iod;
+    _time       = old._time;
+    _updateInt  = old._updateInt;
+    _dClk       = old._dClk;
+    _dotDClk    = old._dotDClk;
+    _dotDotDClk = old._dotDotDClk;
+  }
   static void writeEpoch(std::ostream* out, const QList<t_clkCorr>& corrList);
   static void readEpoch(const std::string& epoLine, std::istream& in, QList<t_clkCorr>& corrList);
@@ -143,4 +163,16 @@
 class t_satCodeBias {
  public:
+  t_satCodeBias() {
+    _updateInt = 0;
+  }
+  t_satCodeBias(const t_satCodeBias& old) { // copy constructor (deep copy)
+    _staID      = old._staID;
+    _prn        = old._prn;
+    _time       = old._time;
+    _updateInt  = old._updateInt;
+    for (unsigned ii = 0; ii < old._bias.size(); ii++) {
+      _bias.push_back(old._bias[ii]);
+    }
+  }
   static void writeEpoch(std::ostream* out, const QList<t_satCodeBias>& biasList);
   static void readEpoch(const std::string& epoLine, std::istream& in, QList<t_satCodeBias>& biasList);
@@ -175,4 +207,17 @@
     _yaw        = 0.0;
     _yawRate    = 0.0;
+  }
+  t_satPhaseBias(const t_satPhaseBias& old) { // copy constructor (deep copy)
+    _staID      = old._staID;
+    _prn        = old._prn;
+    _time       = old._time;
+    _updateInt  = old._updateInt;
+    _dispBiasConstistInd = old._dispBiasConstistInd;
+    _MWConsistInd        = old._MWConsistInd;
+    _yaw                 = old._yaw;
+    _yawRate             = old._yawRate;
+    for (unsigned ii = 0; ii < old._bias.size(); ii++) {
+      _bias.push_back(old._bias[ii]);
+    }
   }
   static void writeEpoch(std::ostream* out, const QList<t_satPhaseBias>& biasList);
@@ -201,4 +246,15 @@
 class t_vTec {
  public:
+  t_vTec(){
+    _updateInt = 0;
+  }
+  t_vTec(const t_vTec& old) { // copy constructor (deep copy)
+    _staID      = old._staID;
+    _time       = old._time;
+    _updateInt  = old._updateInt;
+    for (unsigned ii = 0; ii < old._layers.size(); ii++) {
+      _layers.push_back(old._layers[ii]);
+    }
+  }
   static void write(std::ostream* out, const t_vTec& vTec);
   static void read(const std::string& epoLine, std::istream& in, t_vTec& vTec);
