diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/BGL_Processing.cc b/Appl/CEP/CS1/CS1_BGLProc/src/BGL_Processing.cc
index bb296054c583294132c085e930dbeb1e5eba4ede..e19b53144207dc2f541e74dc8b3117b745d99f72 100644
--- a/Appl/CEP/CS1/CS1_BGLProc/src/BGL_Processing.cc
+++ b/Appl/CEP/CS1/CS1_BGLProc/src/BGL_Processing.cc
@@ -49,12 +49,8 @@ extern "C" {
 
 #endif
 
-#if defined HAVE_MPI
-#if 0 && (defined HAVE_BGP || defined HAVE_BGL)
-#define LOG_CONDITION	(itsCurrentSubband == itsFirstSubband)
-#else
+#if (defined HAVE_BGP || defined HAVE_BGL)
 #define LOG_CONDITION	(itsLocationInfo.rankInPset() == 0)
-#endif
 //#define LOG_CONDITION	(itsLocationInfo.rank() == 0)
 #else
 #define LOG_CONDITION	1
diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/BGL_Processing.h b/Appl/CEP/CS1/CS1_BGLProc/src/BGL_Processing.h
index 3aa1f11e5386a433bfe0d474a9d25a7e4b3ca359..6e6d5b3f4e9f535f4de511d5661b6150163845fe 100644
--- a/Appl/CEP/CS1/CS1_BGLProc/src/BGL_Processing.h
+++ b/Appl/CEP/CS1/CS1_BGLProc/src/BGL_Processing.h
@@ -38,7 +38,7 @@
 #include <InputData.h>
 #include <FilteredData.h>
 #include <TransposedData.h>
-#include <CorrelatedData.h>
+#include <CS1_Interface/CorrelatedData.h>
 
 #include <Transpose.h>
 #include <PPF.h>
diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/CS1_BGL_Processing_main.cc b/Appl/CEP/CS1/CS1_BGLProc/src/CS1_BGL_Processing_main.cc
index 04cfe4b265ed88f372cf267926d9effc05b56f14..41561b6e26e86ff590c798927ea4cab0af412d26 100644
--- a/Appl/CEP/CS1/CS1_BGLProc/src/CS1_BGL_Processing_main.cc
+++ b/Appl/CEP/CS1/CS1_BGLProc/src/CS1_BGL_Processing_main.cc
@@ -34,6 +34,7 @@
 #include <boost/lexical_cast.hpp>
 
 #if defined HAVE_MPI
+#define MPICH_IGNORE_CXX_SEEK
 #include <mpi.h>
 #endif
 
diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.h b/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.h
index 0ebae44d7912c9f28a313db8e8869b6d54caee8e..fb5ac5de54fc54da238ed52bd2046c76b67e3937 100644
--- a/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.h
+++ b/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.h
@@ -7,7 +7,7 @@
 
 
 #include <FilteredData.h>
-#include <CorrelatedData.h>
+#include <CS1_Interface/CorrelatedData.h>
 
 #include <cassert>
 
diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/FIR.cc b/Appl/CEP/CS1/CS1_BGLProc/src/FIR.cc
index ec265d09a161b8ee5b14c81df508333863b6d5cf..57265727689df808bcf1ca10102ad2a3d2b3bfaf 100644
--- a/Appl/CEP/CS1/CS1_BGLProc/src/FIR.cc
+++ b/Appl/CEP/CS1/CS1_BGLProc/src/FIR.cc
@@ -1065,263 +1065,777 @@ const float FIR::bandPassCorrectionFactors[NR_SUBBAND_CHANNELS] __attribute__ ((
   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-#else
-  1.975692231407132,
-  1.962498324924181,
-  1.924261914958563,
-  1.864699021295633,
-  1.78907137682647,
-  1.703175088973576,
-  1.612463246966077,
-  1.521484939796297,
-  1.433660710117561,
-  1.351311201353094,
-  1.275827220806724,
-  1.207888746323126,
-  1.147675226155675,
-  1.095040218979614,
-  1.049643536696084,
-  1.011044479735917,
-  0.9787636905314124,
-  0.9523215598668534,
-  0.9312599993349844,
-  0.9151528506709267,
-  0.9036087557811617,
-  0.8962691444506941,
-  0.8928031350070093,
-  0.8929005483673208,
-  0.8962638533547094,
-  0.9025996395042041,
-  0.9116101099013419,
-  0.9229850657240061,
-  0.9363948854942489,
-  0.951485056208018,
-  0.9678728599580718,
-  0.9851468262228326,
-  1.00286949495398,
-  1.020583872706752,
-  1.037823689912855,
-  1.054127189616387,
-  1.069053731396076,
-  1.082202041516818,
-  1.09322856465348,
-  1.101864160697753,
-  1.107927410398332,
-  1.111333073319362,
-  1.112094753824954,
-  1.110321495206847,
-  1.106208722413461,
-  1.100024566634351,
-  1.092093030233948,
-  1.082775634206881,
-  1.072453132262115,
-  1.061508621907639,
-  1.050313007592447,
-  1.039213354654648,
-  1.028524284576989,
-  1.01852224879176,
-  1.009442302239003,
-  1.001476880158297,
-  0.9947760488797945,
-  0.9894487331891222,
-  0.9855644974035612,
-  0.9831555553725824,
-  0.9822187912506223,
-  0.982717677595194,
-  0.9845840732942905,
-  0.9877199666359203,
-  0.9919992953144312,
-  0.9972700223835789,
-  1.003356671920054,
-  1.010063527048991,
-  1.017178663000801,
-  1.024478927500697,
-  1.031735891373346,
-  1.038722679252303,
-  1.045221464112742,
-  1.051031285103756,
-  1.055975744152761,
-  1.059910071729813,
-  1.062727041314386,
-  1.064361263671191,
-  1.064791504264397,
-  1.064040827572932,
-  1.062174559277828,
-  1.059296244811492,
-  1.055541944343166,
-  1.051073319051722,
-  1.046070019718294,
-  1.040721884974541,
-  1.035221401196279,
-  1.029756783935688,
-  1.024505929795804,
-  1.01963137502198,
-  1.015276296807001,
-  1.011561514692706,
-  1.008583396915006,
-  1.006412550249468,
-  1.005093168907331,
-  1.004642933410796,
-  1.00505337833776,
-  1.006290682393396,
-  1.008296869730762,
-  1.010991442594829,
-  1.01427348762139,
-  1.018024307673964,
-  1.022110625149417,
-  1.026388379800212,
-  1.030707104696889,
-  1.034914810606683,
-  1.038863246864119,
-  1.042413343136149,
-  1.045440580373889,
-  1.047840000199819,
-  1.04953054837592,
-  1.050458465352049,
-  1.050599486431713,
-  1.049959692018171,
-  1.04857494616148,
-  1.046508967203364,
-  1.043850174341402,
-  1.040707536094977,
-  1.037205701855434,
-  1.033479721459843,
-  1.029669650551316,
-  1.025915306250962,
-  1.022351386234867,
-  1.019103103849022,
-  1.016282431249389,
-  1.013984989006764,
-  1.012287579176554,
-  1.011246332037469,
-  1.010895424806088,
-  1.011246332037469,
-  1.012287579176554,
-  1.013984989006764,
-  1.016282431249389,
-  1.019103103849022,
-  1.022351386234867,
-  1.025915306250962,
-  1.029669650551316,
-  1.033479721459843,
-  1.037205701855434,
-  1.040707536094977,
-  1.043850174341402,
-  1.046508967203364,
-  1.04857494616148,
-  1.049959692018171,
-  1.050599486431713,
-  1.050458465352049,
-  1.04953054837592,
-  1.047840000199819,
-  1.045440580373889,
-  1.042413343136149,
-  1.038863246864119,
-  1.034914810606683,
-  1.030707104696889,
-  1.026388379800212,
-  1.022110625149417,
-  1.018024307673964,
-  1.01427348762139,
-  1.010991442594829,
-  1.008296869730762,
-  1.006290682393396,
-  1.00505337833776,
-  1.004642933410796,
-  1.005093168907331,
-  1.006412550249468,
-  1.008583396915006,
-  1.011561514692706,
-  1.015276296807001,
-  1.01963137502198,
-  1.024505929795804,
-  1.029756783935688,
-  1.035221401196279,
-  1.040721884974541,
-  1.046070019718294,
-  1.051073319051722,
-  1.055541944343166,
-  1.059296244811492,
-  1.062174559277828,
-  1.064040827572932,
-  1.064791504264397,
-  1.064361263671191,
-  1.062727041314386,
-  1.059910071729813,
-  1.055975744152761,
-  1.051031285103756,
-  1.045221464112742,
-  1.038722679252303,
-  1.031735891373346,
-  1.024478927500697,
-  1.017178663000801,
-  1.010063527048991,
-  1.003356671920054,
-  0.9972700223835789,
-  0.9919992953144312,
-  0.9877199666359203,
-  0.9845840732942905,
-  0.982717677595194,
-  0.9822187912506223,
-  0.9831555553725824,
-  0.9855644974035612,
-  0.9894487331891222,
-  0.9947760488797945,
-  1.001476880158297,
-  1.009442302239003,
-  1.01852224879176,
-  1.028524284576989,
-  1.039213354654648,
-  1.050313007592447,
-  1.061508621907639,
-  1.072453132262115,
-  1.082775634206881,
-  1.092093030233948,
-  1.100024566634351,
-  1.106208722413461,
-  1.110321495206847,
-  1.112094753824954,
-  1.111333073319362,
-  1.107927410398332,
-  1.101864160697753,
-  1.09322856465348,
-  1.082202041516818,
-  1.069053731396076,
-  1.054127189616387,
-  1.037823689912855,
-  1.020583872706752,
-  1.00286949495398,
-  0.9851468262228326,
-  0.9678728599580718,
-  0.951485056208018,
-  0.9363948854942489,
-  0.9229850657240061,
-  0.9116101099013419,
-  0.9025996395042041,
-  0.8962638533547094,
-  0.8929005483673208,
-  0.8928031350070093,
-  0.8962691444506941,
-  0.9036087557811617,
-  0.9151528506709267,
-  0.9312599993349844,
-  0.9523215598668534,
-  0.9787636905314124,
-  1.011044479735917,
-  1.049643536696084,
-  1.095040218979614,
-  1.147675226155675,
-  1.207888746323126,
-  1.275827220806724,
-  1.351311201353094,
-  1.433660710117561,
-  1.521484939796297,
-  1.612463246966077,
-  1.703175088973576,
-  1.78907137682647,
-  1.864699021295633,
-  1.924261914958563,
-  1.962498324924181,
+#elif 0
+  1.965915323575522, // bijna goed
+  1.953308481212626,
+  1.916733217598856,
+  1.859638464314319,
+  1.786933472189039,
+  1.704067388673839,
+  1.616217384311842,
+  1.527754567525214,
+  1.442014312913755,
+  1.361302696665073,
+  1.287040563162518,
+  1.219960448022757,
+  1.160301327049604,
+  1.107973866518072,
+  1.062687808526147,
+  1.024043459647735,
+  0.9915935260100606,
+  0.9648823614515657,
+  0.9434689181771974,
+  0.9269383883979125,
+  0.9149062309430196,
+  0.907017198423792,
+  0.902941165663904,
+  0.9023669866789222,
+  0.9049952311981201,
+  0.9105304270220405,
+  0.918673321557121,
+  0.9291136409677524,
+  0.9415238388460121,
+  0.9555543598610745,
+  0.9708309689229969,
+  0.9869546839506231,
+  1.00350477301932,
+  1.020045113279848,
+  1.036133950795418,
+  1.051336757504196,
+  1.065241487406192,
+  1.077475145189311,
+  1.087720268618815,
+  1.095729763687178,
+  1.101338573239659,
+  1.104470924198756,
+  1.105142358242079,
+  1.103456334667687,
+  1.099595802484679,
+  1.093810667300047,
+  1.086402443837588,
+  1.077707542314878,
+  1.068080586814908,
+  1.057878945228661,
+  1.047449325893466,
+  1.037116934099133,
+  1.027177341368609,
+  1.01789094281327,
+  1.009479683211916,
+  1.002125623046812,
+  0.9959708812395456,
+  0.9911185148423218,
+  0.9876339589295903,
+  0.9855467356061375,
+  0.9848522359761376,
+  0.9855134733307295,
+  0.9874627930119914,
+  0.9906035997985985,
+  0.9948122237268486,
+  0.999940086827622,
+  1.005816353095994,
+  1.012251238956858,
+  1.019040129065699,
+  1.025968581690565,
+  1.032818221239377,
+  1.0393734087417,
+  1.045428464729819,
+  1.050795107479823,
+  1.055309679882406,
+  1.058839686933884,
+  1.061289165898972,
+  1.062602468561163,
+  1.062766146433962,
+  1.061808782638451,
+  1.059798788005042,
+  1.056840349604049,
+  1.05306786399579,
+  1.0486392870144,
+  1.043728877294577,
+  1.038519801894668,
+  1.033197017486267,
+  1.027940753585485,
+  1.02292082146913,
+  1.018291869252699,
+  1.014189612541227,
+  1.01072799927865,
+  1.007997220695131,
+  1.006062457570695,
+  1.004963249587751,
+  1.004713390791115,
+  1.005301280738498,
+  1.006690693252601,
+  1.008821957438792,
+  1.011613573904094,
+  1.014964308572949,
+  1.018755813551688,
+  1.022855816552948,
+  1.027121896222586,
+  1.031405820878583,
+  1.035558375415212,
+  1.039434540547827,
+  1.042898827448052,
+  1.045830517916551,
+  1.048128524645427,
+  1.049715575680583,
+  1.050541446878027,
+  1.050585016730444,
+  1.049854995370752,
+  1.04838927529659,
+  1.046252953685899,
+  1.043535172236308,
+  1.040344998578112,
+  1.03680662499186,
+  1.03305418138801,
+  1.029226451029444,
+  1.025461744172111,
+  1.021893134330773,
+  1.018644203078808,
+  1.01582538062831,
+  1.013530917843741,
+  1.011836485560426,
+  1.010797371479881,
+  1.010447233693865,
+  1.010797371479881,
+  1.011836485560426,
+  1.013530917843741,
+  1.01582538062831,
+  1.018644203078808,
+  1.021893134330773,
+  1.025461744172111,
+  1.029226451029444,
+  1.03305418138801,
+  1.03680662499186,
+  1.040344998578112,
+  1.043535172236308,
+  1.046252953685899,
+  1.04838927529659,
+  1.049854995370752,
+  1.050585016730444,
+  1.050541446878027,
+  1.049715575680583,
+  1.048128524645427,
+  1.045830517916551,
+  1.042898827448052,
+  1.039434540547827,
+  1.035558375415212,
+  1.031405820878583,
+  1.027121896222586,
+  1.022855816552948,
+  1.018755813551688,
+  1.014964308572949,
+  1.011613573904094,
+  1.008821957438792,
+  1.006690693252601,
+  1.005301280738498,
+  1.004713390791115,
+  1.004963249587751,
+  1.006062457570695,
+  1.007997220695131,
+  1.01072799927865,
+  1.014189612541227,
+  1.018291869252699,
+  1.02292082146913,
+  1.027940753585485,
+  1.033197017486267,
+  1.038519801894668,
+  1.043728877294577,
+  1.0486392870144,
+  1.05306786399579,
+  1.056840349604049,
+  1.059798788005042,
+  1.061808782638451,
+  1.062766146433962,
+  1.062602468561163,
+  1.061289165898972,
+  1.058839686933884,
+  1.055309679882406,
+  1.050795107479823,
+  1.045428464729819,
+  1.0393734087417,
+  1.032818221239377,
+  1.025968581690565,
+  1.019040129065699,
+  1.012251238956858,
+  1.005816353095994,
+  0.999940086827622,
+  0.9948122237268486,
+  0.9906035997985985,
+  0.9874627930119914,
+  0.9855134733307295,
+  0.9848522359761376,
+  0.9855467356061375,
+  0.9876339589295903,
+  0.9911185148423218,
+  0.9959708812395456,
+  1.002125623046812,
+  1.009479683211916,
+  1.01789094281327,
+  1.027177341368609,
+  1.037116934099133,
+  1.047449325893466,
+  1.057878945228661,
+  1.068080586814908,
+  1.077707542314878,
+  1.086402443837588,
+  1.093810667300047,
+  1.099595802484679,
+  1.103456334667687,
+  1.105142358242079,
+  1.104470924198756,
+  1.101338573239659,
+  1.095729763687178,
+  1.087720268618815,
+  1.077475145189311,
+  1.065241487406192,
+  1.051336757504196,
+  1.036133950795418,
+  1.020045113279848,
+  1.00350477301932,
+  0.9869546839506231,
+  0.9708309689229969,
+  0.9555543598610745,
+  0.9415238388460121,
+  0.9291136409677524,
+  0.918673321557121,
+  0.9105304270220405,
+  0.9049952311981201,
+  0.9023669866789222,
+  0.902941165663904,
+  0.907017198423792,
+  0.9149062309430196,
+  0.9269383883979125,
+  0.9434689181771974,
+  0.9648823614515657,
+  0.9915935260100606,
+  1.024043459647735,
+  1.062687808526147,
+  1.107973866518072,
+  1.160301327049604,
+  1.219960448022757,
+  1.287040563162518,
+  1.361302696665074,
+  1.442014312913755,
+  1.527754567525214,
+  1.616217384311843,
+  1.704067388673839,
+  1.786933472189039,
+  1.85963846431432,
+  1.916733217598856,
+  1.953308481212627,
+#elif 0
+  2.113888093682664, // flanken heel sample naar binnen geschoven
+  2.0846625096375,
+  2.029201649386783,
+  1.952775799481345,
+  1.861811105910766,
+  1.762759583099796,
+  1.661268774446889,
+  1.56175739640689,
+  1.467340021066181,
+  1.379972637952689,
+  1.30069519706282,
+  1.229885549947028,
+  1.167479899082031,
+  1.113144203705848,
+  1.06639748161329,
+  1.02669501665094,
+  0.9934810936134402,
+  0.9662199383321464,
+  0.9444117408869748,
+  0.9275988163649994,
+  0.9153654353007707,
+  0.9073337061483571,
+  0.9031570799220834,
+  0.9025125056876618,
+  0.905091928452238,
+  0.9105936328825028,
+  0.9187138539016905,
+  0.9291390644050024,
+  0.9415393821257686,
+  0.955563584905508,
+  0.9708362587423857,
+  0.9869575978887251,
+  1.003506304298827,
+  1.020045874225744,
+  1.036134304327865,
+  1.051336908713669,
+  1.065241545650738,
+  1.077475164733982,
+  1.087720274036879,
+  1.095729764830907,
+  1.101338573423922,
+  1.104470924254207,
+  1.10514235826672,
+  1.103456334640173,
+  1.099595802405221,
+  1.093810667187751,
+  1.086402443712528,
+  1.077707542193984,
+  1.068080586715279,
+  1.057878945168412,
+  1.047449325887134,
+  1.037116934150693,
+  1.027177341466912,
+  1.01789094293294,
+  1.009479683319726,
+  1.002125623111139,
+  0.9959708812394966,
+  0.991118514773599,
+  0.9876339588054988,
+  0.9855467354537673,
+  0.9848522358290837,
+  0.9855134732204992,
+  0.9874627929603684,
+  0.9906035998127953,
+  0.9948122237984606,
+  0.9999400869354166,
+  1.005816353211666,
+  1.012251239052209,
+  1.019040129119442,
+  1.025968581693098,
+  1.032818221194423,
+  1.039373408664523,
+  1.045428464642598,
+  1.050795107405478,
+  1.055309679838557,
+  1.058839686928507,
+  1.061289165928845,
+  1.062602468613374,
+  1.062766146489926,
+  1.061808782679218,
+  1.059798788016425,
+  1.056840349580211,
+  1.053067863940452,
+  1.048639286939521,
+  1.043728877217009,
+  1.038519801831764,
+  1.0331970174516,
+  1.027940753585699,
+  1.022920821502582,
+  1.018291869310093,
+  1.014189612607963,
+  1.010727999338277,
+  1.007997220733078,
+  1.006062457577489,
+  1.004963249561047,
+  1.004713390736166,
+  1.005301280666991,
+  1.006690693180133,
+  1.008821957381498,
+  1.011613573875128,
+  1.014964308579534,
+  1.018755813593373,
+  1.022855816621459,
+  1.027121896303366,
+  1.031405820953745,
+  1.035558375467334,
+  1.039434540563787,
+  1.042898827422071,
+  1.045830517851734,
+  1.04812852455341,
+  1.049715575579299,
+  1.050541446788043,
+  1.050585016670658,
+  1.049854995354379,
+  1.048389275328337,
+  1.046252953760941,
+  1.043535172341266,
+  1.040344998693808,
+  1.036806625097223,
+  1.033054181464299,
+  1.02922645106391,
+  1.025461744160372,
+  1.021893134277482,
+  1.018644202996535,
+  1.015825380534921,
+  1.013530917758819,
+  1.011836485501436,
+  1.010797371458805,
+  1.010447233714926,
+  1.01079737153875,
+  1.011836485645065,
+  1.013530917936708,
+  1.015825380710129,
+  1.018644203131762,
+  1.021893134342431,
+  1.025461744137896,
+  1.029226450953719,
+  1.033054181283408,
+  1.03680662487695,
+  1.040344998473795,
+  1.043535172161656,
+  1.046252953654282,
+  1.048389275312918,
+  1.049854995430456,
+  1.050585016820435,
+  1.05054144697947,
+  1.049715575772879,
+  1.048128524710529,
+  1.045830517942679,
+  1.042898827431986,
+  1.039434540495315,
+  1.035558375339444,
+  1.031405820797127,
+  1.027121896153502,
+  1.022855816510926,
+  1.018755813545054,
+  1.014964308602107,
+  1.011613573961705,
+  1.008821957511566,
+  1.006690693324305,
+  1.005301280793511,
+  1.004713390817805,
+  1.004963249580971,
+  1.006062457532892,
+  1.007997220635825,
+  1.010727999212368,
+  1.014189612484294,
+  1.018291869219548,
+  1.022920821468918,
+  1.0279407536198,
+  1.033197017548528,
+  1.038519801971464,
+  1.043728877368756,
+  1.048639287069273,
+  1.053067864019458,
+  1.056840349592729,
+  1.059798787964429,
+  1.061808782582589,
+  1.062766146381735,
+  1.062602468531216,
+  1.061289165904374,
+  1.058839686978027,
+  1.055309679957391,
+  1.050795107567942,
+  1.045428464807898,
+  1.039373408787226,
+  1.03281822123681,
+  1.025968581636088,
+  1.019040128969065,
+  1.012251238839701,
+  1.005816352986929,
+  0.9999400867552699,
+  0.9948122237125309,
+  0.9906035998505502,
+  0.9874627931226582,
+  0.9855134734779809,
+  0.9848522361282931,
+  0.9855467357297051,
+  0.9876339589978307,
+  0.9911185148423703,
+  0.9959708811760064,
+  1.002125622940567,
+  1.009479683094215,
+  1.017890942716736,
+  1.027177341318032,
+  1.037116934105341,
+  1.047449325952533,
+  1.057878945326396,
+  1.068080586933652,
+  1.077707542437945,
+  1.086402443948368,
+  1.093810667378671,
+  1.099595802512001,
+  1.103456334643121,
+  1.105142358186561,
+  1.104470924013443,
+  1.101338572084191,
+  1.095729758189029,
+  1.087720248700699,
+  1.077475085599282,
+  1.065241332170593,
+  1.05133639352139,
+  1.036133165657096,
+  1.020043531110347,
+  1.003501760553027,
+  0.9869492170238869,
+  0.9708214467413756,
+  0.955538350412498,
+  0.9414977331479895,
+  0.9290721858024907,
+  0.9186089891100836,
+  0.9104325642743338,
+  0.9048489105353429,
+  0.9021514499794783,
+  0.9026277145161602,
+  0.9065663298001578,
+  0.9142637466924735,
+  0.9260301140714808,
+  0.942193548419531,
+  0.9631018048266602,
+  0.9891199584674645,
+  1.020622135664822,
+  1.057974576169999,
+  1.10150639682483,
+  1.15146350016068,
+  1.207940472784776,
+  1.270785736662016,
+  1.339477834969981,
+  1.412977253760604,
+  1.48957041558141,
+  1.566741052344433,
+  1.641125932781103,
+  1.708626846035254,
+  1.76474127960655,
+  1.805122680792996,
+  1.826287630529184,
+#elif 1
+  2.038947506091483, // flanken half sample naar binnen(?) geschoven
+  2.018558077960658,
+  1.972977120023623,
+  1.906528819949688,
+  1.824877598360398,
+  1.733994353919991,
+  1.639322310127149,
+  1.545286932146996,
+  1.455137504874946,
+  1.371021572129987,
+  1.294179212174802,
+  1.225170335501707,
+  1.164084093405356,
+  1.11070859021335,
+  1.06465714735051,
+  1.025456201441634,
+  0.9926028854202513,
+  0.9656002616503042,
+  0.9439768585283681,
+  0.9272955749038299,
+  0.9151555905256871,
+  0.9071897952451164,
+  0.9030594293614111,
+  0.9024470662179123,
+  0.9050487094022567,
+  0.910565569485527,
+  0.918695987124404,
+  0.929127946342735,
+  0.9415326444262981,
+  0.9555596253086274,
+  0.9708340134964368,
+  0.986956376884044,
+  1.003505672233602,
+  1.020045565714832,
+  1.036134164108476,
+  1.051336850384274,
+  1.065241523993099,
+  1.077475157830469,
+  1.087720272264467,
+  1.095729764496782,
+  1.101338573370022,
+  1.104470924229987,
+  1.105142358259658,
+  1.103456334661163,
+  1.099595802450511,
+  1.093810667246829,
+  1.08640244377579,
+  1.077707542253145,
+  1.068080586761532,
+  1.057878945192689,
+  1.047449325883006,
+  1.037116934117872,
+  1.027177341412987,
+  1.017890942872165,
+  1.00947968326922,
+  1.002125623085949,
+  0.9959708812482636,
+  0.991118514816177,
+  0.9876339588731116,
+  0.9855467355314945,
+  0.9848522358998286,
+  0.985513473269309,
+  0.9874627929779949,
+  0.9906035997976567,
+  0.9948122237566455,
+  0.9999400868788328,
+  1.005816353154877,
+  1.012251239008794,
+  1.019040129098774,
+  1.025968581698311,
+  1.032818221222034,
+  1.039373408705727,
+  1.045428464685851,
+  1.050795107439664,
+  1.055309679855869,
+  1.058839686926326,
+  1.061289165910132,
+  1.062602468585574,
+  1.06276614646271,
+  1.061808782661769,
+  1.059798788014987,
+  1.056840349596539,
+  1.053067863971528,
+  1.048639286978501,
+  1.043728877255099,
+  1.038519801860483,
+  1.033197017464846,
+  1.027940753581138,
+  1.022920821482083,
+  1.018291869279165,
+  1.014189612574393,
+  1.010727999310303,
+  1.007997220717535,
+  1.006062457578311,
+  1.004963249578435,
+  1.004713390766565,
+  1.005301280703876,
+  1.006690693215417,
+  1.008821957407281,
+  1.011613573885429,
+  1.014964308571641,
+  1.018755813568528,
+  1.022855816584713,
+  1.02712189626261,
+  1.031405820918091,
+  1.035558375445167,
+  1.039434540560902,
+  1.042898827440303,
+  1.045830517888411,
+  1.048128524601764,
+  1.049715575629796,
+  1.050541446830341,
+  1.050585016695782,
+  1.049854995356628,
+  1.048389275306515,
+  1.046252953718625,
+  1.043535172286077,
+  1.040344998635846,
+  1.036806625047012,
+  1.03305418143069,
+  1.029226451052359,
+  1.025461744171944,
+  1.021893134308742,
+  1.018644203040325,
+  1.015825380581836,
+  1.013530917799079,
+  1.011836485526799,
+  1.010797371464144,
+  1.0104472336992,
+  1.010797371505191,
+  1.011836485600552,
+  1.013530917890444,
+  1.015825380671859,
+  1.01864420310987,
+  1.021893134342265,
+  1.025461744160645,
+  1.029226450996083,
+  1.033054181338161,
+  1.036806624934291,
+  1.04034499852326,
+  1.043535172194211,
+  1.046252953664166,
+  1.048389275298833,
+  1.049854995395841,
+  1.050585016772747,
+  1.050541446928603,
+  1.049715575729084,
+  1.048128524682265,
+  1.045830517934886,
+  1.042898827445148,
+  1.039434540525495,
+  1.035558375379271,
+  1.031405820837486,
+  1.027121896185532,
+  1.022855816527902,
+  1.018755813543736,
+  1.014964308583319,
+  1.01161357393002,
+  1.008821957474224,
+  1.006690693289588,
+  1.005301280768933,
+  1.004713390808494,
+  1.004963249588571,
+  1.006062457555211,
+  1.007997220667307,
+  1.010727999245308,
+  1.014189612510548,
+  1.018291869232384,
+  1.022920821464613,
+  1.027940753598596,
+  1.033197017514692,
+  1.038519801932379,
+  1.043728877333192,
+  1.048639287045215,
+  1.053067864012002,
+  1.056840349602618,
+  1.059798787987659,
+  1.061808782611284,
+  1.062766146406154,
+  1.062602468542405,
+  1.06128916589678,
+  1.058839686951313,
+  1.055309679916886,
+  1.050795107523522,
+  1.045428464771504,
+  1.039373408769663,
+  1.03281822124466,
+  1.025968581669614,
+  1.0190401290217,
+  1.012251238899341,
+  1.005816353038743,
+  0.999940086785375,
+  0.9948122237115806,
+  0.9906035998163367,
+  0.9874627930609954,
+  0.9855134734015686,
+  0.9848522360537557,
+  0.9855467356734652,
+  0.9876339589718689,
+  0.9911185148510041,
+  0.9959708812146632,
+  1.002125622997039,
+  1.009479683152141,
+  1.017890942760315,
+  1.027177341336412,
+  1.037116934095086,
+  1.047449325917267,
+  1.057878945274034,
+  1.068080586873016,
+  1.077707542377131,
+  1.086402443895869,
+  1.093810667344861,
+  1.099595802505523,
+  1.103456334660647,
+  1.105142358217829,
+  1.10447092414455,
+  1.101338572902103,
+  1.095729761888568,
+  1.087720261583396,
+  1.077475123031367,
+  1.06524142752371,
+  1.051336613139944,
+  1.036133632476149,
+  1.020044460208784,
+  1.003503510729106,
+  0.9869523635319384,
+  0.9708268817877824,
+  0.9555474200858211,
+  0.9415124224182155,
+  0.9290953674032737,
+  0.9186447579460151,
+  0.9104866870366122,
+  0.9049294312108498,
+  0.9022695068861906,
+  0.9027986446675698,
+  0.9068111633802198,
+  0.9146112300555967,
+  0.9265194458473717,
+  0.9428780713374721,
+  0.9640539653296029,
+  0.9904379223679894,
+  1.022438517524078,
+  1.060467772692177,
+  1.104914951367589,
+  1.156103661406894,
+  1.214226476109058,
+  1.279251091208227,
+  1.350793770295983,
+  1.42796130958598,
+  1.509174243337145,
+  1.592003148295626,
+  1.67307511750313,
+  1.748130075538682,
+  1.812308176701519,
+  1.860706758630789,
+  1.889148248238764,
 #endif
 #else
 #error Not implemented
diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/Makefile.am b/Appl/CEP/CS1/CS1_BGLProc/src/Makefile.am
index ac371727a8a61d88981c3f6e5010045dbd3f7f81..564defebfe9357a5bb454460294fed7f23ea98c2 100644
--- a/Appl/CEP/CS1/CS1_BGLProc/src/Makefile.am
+++ b/Appl/CEP/CS1/CS1_BGLProc/src/Makefile.am
@@ -7,7 +7,6 @@ FIR_Asm.h		\
 InputData.h		\
 FilteredData.h		\
 TransposedData.h	\
-CorrelatedData.h	\
 FIR.h			\
 PPF.h			\
 Transpose.h		\
diff --git a/Appl/CEP/CS1/CS1_BGLProc/test/tBGL_Processing.cc b/Appl/CEP/CS1/CS1_BGLProc/test/tBGL_Processing.cc
index b3cc89a5c4867c05b9a382f3cc75f93759f87613..3ba3c2e62c25e0ced90559603f75b641b2be366e 100644
--- a/Appl/CEP/CS1/CS1_BGLProc/test/tBGL_Processing.cc
+++ b/Appl/CEP/CS1/CS1_BGLProc/test/tBGL_Processing.cc
@@ -23,8 +23,16 @@
 //# Always #include <lofar_config.h> first!
 #include <lofar_config.h>
 
+#include <CS1_Interface/BGL_Configuration.h>
+#include <Common/DataConvert.h>
+#include <Common/Exception.h>
+#include <Common/Timer.h>
+#include <PPF.h>
+#include <Correlator.h>
+
 #if defined HAVE_MPI
-#include <Transport/TH_MPI.h>
+#define MPICH_IGNORE_CXX_SEEK
+#include <mpi.h>
 #endif
 
 #if defined HAVE_BGL
@@ -32,17 +40,11 @@
 #include <rts.h>
 #endif
 
-#include <CS1_Interface/BGL_Configuration.h>
-#include <Common/DataConvert.h>
-#include <Common/Exception.h>
-#include <Common/Timer.h>
-#include <Transport/TH_Null.h>
-#include <PPF.h>
-#include <Correlator.h>
 #include <cmath>
 #include <cstring>
 #include <exception>
 
+
 using namespace LOFAR;
 using namespace LOFAR::CS1;
 
@@ -248,7 +250,7 @@ int main (int argc, char **argv)
 #endif
 
 #if defined HAVE_MPI
-  TH_MPI::initMPI(argc, argv);
+  MPI_Init(&argc, &argv);
 #else
   argc = argc; argv = argv;    // Keep compiler happy ;-)
 #endif
@@ -267,7 +269,7 @@ int main (int argc, char **argv)
   }
 
 #if defined HAVE_MPI
-  TH_MPI::finalize();
+  MPI_Finalize();
 #endif
 
   return retval;
diff --git a/Appl/CEP/CS1/CS1_IONProc/configure.in b/Appl/CEP/CS1/CS1_IONProc/configure.in
index 90f676d5542534c35bd85f03ea13261928e2ac49..2e45508b9dac6d9996010da300cfcfba4e7d8f03 100644
--- a/Appl/CEP/CS1/CS1_IONProc/configure.in
+++ b/Appl/CEP/CS1/CS1_IONProc/configure.in
@@ -55,13 +55,13 @@ dnl lofar_BLITZ
 lofar_INTERNAL(LCS/Common,Common,,1,Common/LofarTypedefs.h,,)
 lofar_INTERNAL(LCS/AMC/AMCBase,AMCBase,,1,AMCBase/Converter.h)
 lofar_INTERNAL(LCS/AMC/AMCImpl,AMCImpl,,1,AMCImpl/ConverterImpl.h)
-lofar_INTERNAL(LCS/Transport,Transport,,1,Transport/DataHolder.h,,)
+dnl lofar_INTERNAL(LCS/Transport,Transport,,1,Transport/DataHolder.h,,)
 lofar_INTERNAL(LCS/Stream,Stream,,1,Stream/Stream.h,,)
-lofar_INTERNAL(LCS/Blob,Blob,,1,Blob/BlobHeader.h,,)
+dnl lofar_INTERNAL(LCS/Blob,Blob,,1,Blob/BlobHeader.h,,)
 lofar_INTERNAL(LCS/ACC/APS,APS,,1,APS/ParameterSet.h,,)
 lofar_INTERNAL(LCS/ACC/PLC,PLC,,1,PLC/ACCmain.h,,)
-lofar_INTERNAL(CEP/tinyCEP,tinyCEP,,1,tinyCEP/TinyDataManager.h,,)
-lofar_INTERNAL(CEP/CEPFrame,CEPFrame,,1,CEPFrame/DataManager.h,,)
+dnl lofar_INTERNAL(CEP/tinyCEP,tinyCEP,,1,tinyCEP/TinyDataManager.h,,)
+dnl lofar_INTERNAL(CEP/CEPFrame,CEPFrame,,1,CEPFrame/DataManager.h,,)
 lofar_INTERNAL(Appl/CEP/CS1/CS1_Interface,CS1_Interface,,1,CS1_Interface/CS1_Config.h,,)
 lofar_INTERNAL(Appl/ApplCommon,ApplCommon,,1,ApplCommon/Observation.h,,)
 lofar_EXTERNAL(bglpersonality,0,bglpersonality.h,"",/bgl/BlueLight/ppcfloor/bglsys)
diff --git a/Appl/CEP/CS1/CS1_IONProc/src/AH_ION_Gather.cc b/Appl/CEP/CS1/CS1_IONProc/src/AH_ION_Gather.cc
deleted file mode 100644
index b5954a3b0dc1a675a9d39e2cc977e35d7ee34892..0000000000000000000000000000000000000000
--- a/Appl/CEP/CS1/CS1_IONProc/src/AH_ION_Gather.cc
+++ /dev/null
@@ -1,108 +0,0 @@
-//#  AH_ION_Gather.cc: 
-//#
-//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
-//#
-//#  This program is free software; you can redistribute it and/or modify
-//#  it under the terms of the GNU General Public License as published by
-//#  the Free Software Foundation; either version 2 of the License, or
-//#  (at your option) any later version.
-//#
-//#  This program is distributed in the hope that it will be useful,
-//#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//#  GNU General Public License for more details.
-//#
-//#  You should have received a copy of the GNU General Public License
-//#  along with this program; if not, write to the Free Software
-//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-//#
-//#  $Id$
-
-
-//# Always #include <lofar_config.h> first!
-#include <lofar_config.h>
-
-#include <Common/lofar_iostream.h>
-#include <Common/Timer.h>
-#include <CEPFrame/Step.h>
-#include <AH_ION_Gather.h>
-#include <BGL_Personality.h>
-#include <WH_ION_Gather.h>
-
-
-namespace LOFAR {
-namespace CS1 {
-
-
-AH_ION_Gather::AH_ION_Gather(const std::vector<Stream *> &clientStreams, unsigned myPsetNumber) 
-:
-  itsCS1PS(0),
-  itsWH(0),
-  itsVisibilitiesStub(0),
-  itsPsetNumber(myPsetNumber),
-  itsClientStreams(clientStreams)
-{
-}
-
-
-AH_ION_Gather::~AH_ION_Gather()
-{
-  undefine();
-}
-
-
-void AH_ION_Gather::define(const KeyValueMap&)
-{
-  itsCS1PS = new CS1_Parset(&itsParamSet);
-
-  itsWH = new WH_ION_Gather("ION_Gather", itsPsetNumber, itsCS1PS, itsClientStreams);
-  itsWH->runOnNode(0);
-
-  DataManager *dm = new DataManager(itsWH->getDataManager());
-  itsWH->setDataManager(dm);
-  dm->setOutBuffer(0, false, 2);
-
-  itsVisibilitiesStub = new Stub_BGL(true, false, "BGLProc_Storage", itsCS1PS);
-
-  unsigned myPsetIndex	     = itsCS1PS->outputPsetIndex(itsPsetNumber);
-  unsigned nrPsetsPerStorage = itsCS1PS->nrPsetsPerStorage();
-  unsigned storage_host	     = myPsetIndex / nrPsetsPerStorage;
-  unsigned storage_port      = myPsetIndex % nrPsetsPerStorage;
-
-  itsVisibilitiesStub->connect(storage_host, storage_port, *dm, /*channel*/ 0);
-}
-
-
-void AH_ION_Gather::undefine()
-{
-  delete itsWH;			itsWH		    = 0;
-  delete itsVisibilitiesStub;	itsVisibilitiesStub = 0;
-  delete itsCS1PS;		itsCS1PS	    = 0;
-}  
-
-
-void AH_ION_Gather::prerun()
-{
-  itsWH->basePreprocess();
-}
-
-
-void AH_ION_Gather::run(int steps)
-{
-  for (int i = 0; i < steps; i++) {
-    //class NSTimer timer("baseProcess", true);
-
-    //timer.start();
-    itsWH->baseProcess();
-    //timer.stop();
-  }
-}
-
-
-void AH_ION_Gather::postrun()
-{
-  itsWH->basePostprocess();
-}
-
-} // namespace CS1
-} // namespace LOFAR
diff --git a/Appl/CEP/CS1/CS1_IONProc/src/AH_ION_Gather.h b/Appl/CEP/CS1/CS1_IONProc/src/AH_ION_Gather.h
deleted file mode 100644
index 66c9520542150373128af7045b0a042404c339ca..0000000000000000000000000000000000000000
--- a/Appl/CEP/CS1/CS1_IONProc/src/AH_ION_Gather.h
+++ /dev/null
@@ -1,56 +0,0 @@
-//#  AH_ION_Gather.h: 
-//#
-//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
-//#
-//#  This program is free software; you can redistribute it and/or modify
-//#  it under the terms of the GNU General Public License as published by
-//#  the Free Software Foundation; either version 2 of the License, or
-//#  (at your option) any later version.
-//#
-//#  This program is distributed in the hope that it will be useful,
-//#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//#  GNU General Public License for more details.
-//#
-//#  You should have received a copy of the GNU General Public License
-//#  along with this program; if not, write to the Free Software
-//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-//#
-//#  $Id$
-
-#ifndef LOFAR_CS1_ION_PROC_AH_ION_GATHER_H
-#define LOFAR_CS1_ION_PROC_AH_ION_GATHER_H
-
-#include <CEPFrame/ApplicationHolder.h>
-#include <CS1_Interface/Stub_BGL.h>
-#include <Stream/Stream.h>
-#include <WH_ION_Gather.h>
-
-
-namespace LOFAR {
-namespace CS1 {
-
-class AH_ION_Gather : public ApplicationHolder
-{
-  public:
-		 AH_ION_Gather(const std::vector<Stream *> &clientTHs, unsigned myPsetNumber);
-    virtual	 ~AH_ION_Gather();
-    virtual void undefine();
-    virtual void define(const KeyValueMap&);
-    virtual void prerun();
-    virtual void run(int nsteps);
-    virtual void postrun();
-
-  private:
-    CS1_Parset	  *itsCS1PS;
-    WH_ION_Gather *itsWH;
-    Stub_BGL	  *itsVisibilitiesStub;
-    unsigned	  itsPsetNumber;
-
-    const std::vector<Stream *> &itsClientStreams;
-};
-
-} // namespace CS1
-} // namespace LOFAR
-
-#endif
diff --git a/Appl/CEP/CS1/CS1_IONProc/src/CS1_ION_main.cc b/Appl/CEP/CS1/CS1_IONProc/src/CS1_ION_main.cc
index 33db9fb017010a2400bc2c0a7b52dfbee98df8c4..e88fc55c9ae74bb071fa7d0935078ae1eb7aefea 100644
--- a/Appl/CEP/CS1/CS1_IONProc/src/CS1_ION_main.cc
+++ b/Appl/CEP/CS1/CS1_IONProc/src/CS1_ION_main.cc
@@ -21,13 +21,12 @@
 #include <lofar_config.h>
 
 #include <PLC/ACCmain.h>
-#include <tinyCEP/ApplicationHolderController.h>
 #include <CS1_Interface/BGL_Command.h>
 #include <CS1_Interface/BGL_Configuration.h>
 #include <CS1_Interface/BGL_Mapping.h>
 #include <CS1_Interface/CS1_Parset.h>
 #include <InputSection.h>
-#include <AH_ION_Gather.h>
+#include <OutputSection.h>
 #include <Stream/FileStream.h>
 #include <Stream/NullStream.h>
 #include <Stream/SocketStream.h>
@@ -63,7 +62,7 @@ using namespace LOFAR::CS1;
 static char	   **global_argv;
 static std::string blockID;
 static unsigned    myPsetNumber, nrPsets, nrCoresPerPset;
-static unsigned    nrInputSectionRuns;
+static unsigned    nrInputSectionRuns, nrOutputSectionRuns;
 static std::vector<Stream *> clientStreams;
 
 #if defined HAVE_FCNP && defined __PPC__
@@ -197,7 +196,7 @@ static void stopCNs()
 }
 
 
-static void *input_thread(void *parset)
+static void *inputSection(void *parset)
 {
   std::clog << "starting input section" << std::endl;
 
@@ -223,23 +222,28 @@ static void *input_thread(void *parset)
 }
 
 
-static void *gather_thread(void *argv)
+static void *outputSection(void *parset)
 {
-  std::clog << "starting gather thread, nrRuns = " << ((char **) argv)[2] << std::endl;
+  std::clog << "starting output section" << std::endl;
 
   try {
-    AH_ION_Gather myAH(clientStreams, myPsetNumber);
-    ApplicationHolderController myAHController(myAH, 1); //listen to ACC every 1 runs
-    ACC::PLC::ACCmain(3, (char **) argv, &myAHController);
+    OutputSection outputSection(myPsetNumber, clientStreams);
+
+    outputSection.preprocess(static_cast<CS1_Parset *>(parset));
+
+    for (unsigned run = 0; run < nrOutputSectionRuns; run ++)
+      outputSection.process();
+
+    outputSection.postprocess();
   } catch (Exception &ex) {
-    std::cerr << "gather thread caught Exception: " << ex << std::endl;
+    std::cerr << "output section caught Exception: " << ex << std::endl;
   } catch (std::exception &ex) {
-    std::cerr << "gather thread caught std::exception: " << ex.what() << std::endl;
+    std::cerr << "output section caught std::exception: " << ex.what() << std::endl;
   } catch (...) {
-    std::cerr << "gather thread caught non-std::exception: " << std::endl;
+    std::cerr << "output section caught non-std::exception: " << std::endl;
   }
 
-  std::clog << "gather thread finished" << std::endl;
+  std::clog << "output section finished" << std::endl;
   return 0;
 }
 
@@ -271,8 +275,7 @@ void *master_thread(void *)
   try {
     setenv("AIPSPATH", "/cephome/romein/packages/casacore-0.3.0/stage/", 0); // FIXME
 
-    pthread_t input_thread_id = 0, gather_thread_id = 0;
-
+    pthread_t input_thread_id, output_thread_id;
     std::clog << "trying to use " << global_argv[1] << " as ParameterSet" << std::endl;
     ACC::APS::ParameterSet parameterSet(global_argv[1]);
     CS1_Parset parset(&parameterSet);
@@ -280,6 +283,9 @@ void *master_thread(void *)
     parset.adoptFile("OLAP.parset");
     checkParset(parset);
 
+    bool hasInputSection  = parset.inputPsetIndex(myPsetNumber) >= 0;
+    bool hasOutputSection = parset.outputPsetIndex(myPsetNumber) >= 0;
+
 #if !defined HAVE_ZOID
     nrCoresPerPset = parset.nrCoresPerPset();
     string streamType = parset.getTransportType("OLAP.OLAP_Conn.IONProc_BGLProc");
@@ -288,49 +294,25 @@ void *master_thread(void *)
 
     configureCNs(parset);
 
-    if (parset.inputPsetIndex(myPsetNumber) >= 0) {
-#if 0
-      static char nrRuns[16], *argv[] = {
-	global_argv[0],
-	global_argv[1],
-	nrRuns,
-	0
-      };
-
-      sprintf(nrRuns, "%u", atoi(global_argv[2]) * parset.nrCoresPerPset() / parset.nrSubbandsPerPset());
-
-      if (pthread_create(&input_thread_id, 0, input_thread, argv) != 0) {
-	perror("pthread_create");
-	exit(1);
-      }
-#else
-      // Passing this via a global variable is a real hack
+    if (hasInputSection) {
       nrInputSectionRuns = atoi(global_argv[2]) * parset.nrCoresPerPset() / parset.nrSubbandsPerPset();
 
-      if (pthread_create(&input_thread_id, 0, input_thread, static_cast<void *>(&parset)) != 0) {
+      if (pthread_create(&input_thread_id, 0, inputSection, static_cast<void *>(&parset)) != 0) {
 	perror("pthread_create");
 	exit(1);
       }
-#endif
     }
 
-    if (parset.outputPsetIndex(myPsetNumber) >= 0) {
-      static char nrRuns[16], *argv[] = {
-	global_argv[0],
-	global_argv[1],
-	nrRuns,
-	0
-      };
-
-      sprintf(nrRuns, "%u", atoi(global_argv[2]) * parset.nrCoresPerPset());
+    if (hasOutputSection) {
+      nrOutputSectionRuns = atoi(global_argv[2]) * parset.nrCoresPerPset();
 
-      if (pthread_create(&gather_thread_id, 0, gather_thread, argv) != 0) {
+      if (pthread_create(&output_thread_id, 0, outputSection, static_cast<void *>(&parset)) != 0) {
 	perror("pthread_create");
 	exit(1);
       }
     }
 
-    if (gather_thread_id != 0 && input_thread_id == 0) {
+    if (!hasInputSection && hasOutputSection) {
       // quick hack to send PROCESS commands to CNs
 
       BGL_Command command(BGL_Command::PROCESS);
@@ -342,7 +324,7 @@ void *master_thread(void *)
 	  command.write(clientStreams[BGL_Mapping::mapCoreOnPset(core, myPsetNumber)]);
     }
 
-    if (input_thread_id != 0) {
+    if (hasInputSection) {
       if (pthread_join(input_thread_id, 0) != 0) {
 	perror("pthread join");
 	exit(1);
@@ -354,13 +336,13 @@ void *master_thread(void *)
     unconfigureCNs();
     stopCNs();
 
-    if (gather_thread_id != 0) {
-      if (pthread_join(gather_thread_id, 0) != 0) {
+    if (hasOutputSection) {
+      if (pthread_join(output_thread_id, 0) != 0) {
 	perror("pthread join");
 	exit(1);
       }
 
-      std::clog << "lofar__fini: gather thread joined" << std::endl;
+      std::clog << "lofar__fini: output thread joined" << std::endl;
     }
   } catch (Exception &ex) {
     std::cerr << "main thread caught Exception: " << ex << std::endl;
diff --git a/Appl/CEP/CS1/CS1_IONProc/src/Makefile.am b/Appl/CEP/CS1/CS1_IONProc/src/Makefile.am
index 93052bb2847faef1cfafe554ba435377b6286b7b..746e01c7bf7f37826bb1bcc908f6c6a6b8f3a514 100644
--- a/Appl/CEP/CS1/CS1_IONProc/src/Makefile.am
+++ b/Appl/CEP/CS1/CS1_IONProc/src/Makefile.am
@@ -1,31 +1,29 @@
 pkginclude_HEADERS = Package__Version.h \
 BeamletBuffer.h			\
 BGL_Personality.h		\
+InputSection.h			\
 InputThread.h			\
 ION_Allocator.h			\
 LockedRanges.h			\
 LogThread.h			\
+OutputSection.h			\
 ReaderWriterSynchronization.h	\
 SlidingPointer.h		\
 WallClockTime.h			\
-InputSection.h			\
 WH_DelayCompensation.h		\
-AH_ION_Gather.h			\
-WH_ION_Gather.h			\
 FCNP_ServerStream.h
 
 liblofar_impl_la_SOURCES = $(pkginclude_HEADERS) \
 BeamletBuffer.cc		\
 BGL_Personality.cc		\
 CS1_ION_main.cc		 	\
+InputSection.cc			\
 InputThread.cc			\
 ION_Allocator.cc		\
 LogThread.cc			\
+OutputSection.cc		\
 ReaderWriterSynchronization.cc	\
-InputSection.cc			\
 WH_DelayCompensation.cc		\
-AH_ION_Gather.cc		\
-WH_ION_Gather.cc		\
 FCNP_ServerStream.cc		\
 Package__Version.cc
 
diff --git a/Appl/CEP/CS1/CS1_IONProc/src/OutputSection.cc b/Appl/CEP/CS1/CS1_IONProc/src/OutputSection.cc
new file mode 100644
index 0000000000000000000000000000000000000000..08643ca1ebcdfe3776c0ebb2ebb7bdc1a9dd6115
--- /dev/null
+++ b/Appl/CEP/CS1/CS1_IONProc/src/OutputSection.cc
@@ -0,0 +1,202 @@
+//#  OutputSection.cc: Collects data from CNs and sends data to Storage
+//#
+//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//#  This program is free software; you can redistribute it and/or modify
+//#  it under the terms of the GNU General Public License as published by
+//#  the Free Software Foundation; either version 2 of the License, or
+//#  (at your option) any later version.
+//#
+//#  This program is distributed in the hope that it will be useful,
+//#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//#  GNU General Public License for more details.
+//#
+//#  You should have received a copy of the GNU General Public License
+//#  along with this program; if not, write to the Free Software
+//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//#  $Id$
+
+//# Always #include <lofar_config.h> first!
+#include <lofar_config.h>
+
+#include <CS1_Interface/BGL_Mapping.h>
+#include <CS1_Interface/Allocator.h>
+#include <OutputSection.h>
+
+#include <Stream/FileStream.h>
+#include <Stream/NullStream.h>
+#include <Stream/SocketStream.h>
+
+#include <boost/lexical_cast.hpp>
+#include <cstring>
+#include <string>
+#include <stdexcept>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+
+
+namespace LOFAR {
+namespace CS1 {
+
+OutputSection::OutputSection(unsigned psetNumber, const std::vector<Stream *> &streamsFromCNs)
+:
+  itsPsetNumber(psetNumber),
+  itsStreamsFromCNs(streamsFromCNs)
+{
+}
+
+
+OutputSection::~OutputSection()
+{
+}
+
+
+void *OutputSection::sendThreadStub(void *arg)
+{
+  std::clog << "sendThread started" << std::endl;
+
+  try {
+    static_cast<OutputSection *>(arg)->sendThread();
+  } catch (std::exception &ex) {
+    std::cerr << "Caught std::exception: " << ex.what() << std::endl;
+  } catch (...) {
+    std::cerr << "Caught non-std::exception" << std::endl;
+  }
+
+  std::clog << "sendThread finished" << std::endl;
+  return 0;
+}
+
+
+void OutputSection::sendThread()
+{
+  while (1) { // FIXME: stop thread
+    CorrelatedData *data = itsSendQueue.remove();
+
+    data->write(itsStreamToStorage);
+    itsFreeQueue.append(data);
+  }
+}
+
+
+void OutputSection::connectToStorage(const CS1_Parset *ps)
+{
+  unsigned myPsetIndex       = ps->outputPsetIndex(itsPsetNumber);
+  unsigned nrPsetsPerStorage = ps->nrPsetsPerStorage();
+  unsigned storageHostIndex  = myPsetIndex / nrPsetsPerStorage;
+  unsigned storagePortIndex  = myPsetIndex % nrPsetsPerStorage;
+
+  string   prefix	     = "OLAP.OLAP_Conn.BGLProc_Storage";
+  string   connectionType    = ps->getString(prefix + "_Transport");
+
+  if (connectionType == "NULL") {
+    std::clog << "output section discards data to null:" << std::endl;
+    itsStreamToStorage = new NullStream;
+  } else if (connectionType == "TCP") {
+    std::string    server = ps->getStringVector(prefix + "_ServerHosts")[storageHostIndex];
+    unsigned short port   = boost::lexical_cast<unsigned short>(ps->getPortsOf(prefix)[storagePortIndex]);
+
+    std::clog << "output section connects to tcp:" << server << ':' << port << std::endl;
+    itsStreamToStorage = new SocketStream(server.c_str(), port, SocketStream::TCP, SocketStream::Client);
+  } else if (connectionType == "FILE") {
+    std::string filename = ps->getString(prefix + "_BaseFileName") + '.' +
+		    boost::lexical_cast<std::string>(storageHostIndex) + '.' +
+		    boost::lexical_cast<std::string>(storagePortIndex);
+
+    std::clog << "output section write to file:" << filename << std::endl;
+    itsStreamToStorage = new FileStream(filename.c_str(), 0666);
+  } else {
+    throw std::runtime_error("unsupported ION->Storage stream type");
+  }
+}
+
+
+void OutputSection::preprocess(const CS1_Parset *ps)
+{
+  itsNrComputeCores	    = ps->nrCoresPerPset();
+  itsCurrentComputeCore	    = 0;
+  itsNrSubbandsPerPset	    = ps->nrSubbandsPerPset();
+  itsCurrentSubband	    = 0;
+  itsNrIntegrationSteps     = ps->IONintegrationSteps();
+  itsCurrentIntegrationStep = 0;
+
+  connectToStorage(ps);
+
+  unsigned nrBuffers   = itsNrSubbandsPerPset + 1 /* itsTmpSum */ + maxSendQueueSize;
+  unsigned nrBaselines = ps->nrBaselines();
+
+  itsArena  = new MallocedArena(nrBuffers * CorrelatedData::requiredSize(nrBaselines), 32);
+  itsTmpSum = new CorrelatedData(*itsArena, nrBaselines);
+
+  for (unsigned subband = 0; subband < itsNrSubbandsPerPset; subband ++)
+    itsVisibilitySums.push_back(new CorrelatedData(*itsArena, nrBaselines));
+
+  for (unsigned i = 0; i < maxSendQueueSize; i ++)
+    itsFreeQueue.append(new CorrelatedData(*itsArena, nrBaselines));
+
+  if (pthread_create(&itsSendThread, 0, sendThreadStub, this) != 0)
+    throw std::runtime_error("could not create send thread");
+}
+
+
+void OutputSection::process()
+{
+  bool firstTime = itsCurrentIntegrationStep == 0;
+  bool lastTime  = itsCurrentIntegrationStep == itsNrIntegrationSteps - 1;
+
+  std::clog << "itsCurrentComputeCore = " << itsCurrentComputeCore << ", itsCurrentSubband = " << itsCurrentSubband << ", itsCurrentIntegrationStep = " << itsCurrentIntegrationStep << ", firstTime = " << firstTime << ", lastTime = " << lastTime << std::endl;
+  CorrelatedData *data	 = lastTime ? itsFreeQueue.remove() : firstTime ? itsVisibilitySums[itsCurrentSubband] : itsTmpSum;
+  
+  unsigned	 channel = BGL_Mapping::mapCoreOnPset(itsCurrentComputeCore, itsPsetNumber);
+
+  data->read(itsStreamsFromCNs[channel]);
+
+  if (!firstTime)
+    if (lastTime)
+      *data += *itsVisibilitySums[itsCurrentSubband];
+    else
+      *itsVisibilitySums[itsCurrentSubband] += *itsTmpSum;
+
+  if (lastTime)
+    itsSendQueue.append(data);
+
+  if (++ itsCurrentComputeCore == itsNrComputeCores)
+    itsCurrentComputeCore = 0;
+
+  if (++ itsCurrentSubband == itsNrSubbandsPerPset) {
+    itsCurrentSubband = 0;
+
+    if (++ itsCurrentIntegrationStep == itsNrIntegrationSteps)
+      itsCurrentIntegrationStep = 0;
+  }
+}
+
+
+void OutputSection::postprocess()
+{
+  for (unsigned subband = 0; subband < itsVisibilitySums.size(); subband ++)
+    delete itsVisibilitySums[subband];
+
+  itsVisibilitySums.resize(0);
+
+  delete itsTmpSum; itsTmpSum = 0;
+
+  for (unsigned i = 0; i < maxSendQueueSize; i ++)
+    delete itsFreeQueue.remove();
+
+  if (pthread_join(itsSendThread, 0) != 0)
+    throw std::runtime_error("could not join send thread");
+
+  delete itsArena;		itsArena = 0;
+  delete itsStreamToStorage;	itsStreamToStorage = 0;
+}
+
+}
+}
diff --git a/Appl/CEP/CS1/CS1_IONProc/src/WH_ION_Gather.h b/Appl/CEP/CS1/CS1_IONProc/src/OutputSection.h
similarity index 53%
rename from Appl/CEP/CS1/CS1_IONProc/src/WH_ION_Gather.h
rename to Appl/CEP/CS1/CS1_IONProc/src/OutputSection.h
index 21f9f0958e3696faa15c67ecd9a3c457330d67e8..d2006a6793fc2b84403597bb659bfe3bcaa906cd 100644
--- a/Appl/CEP/CS1/CS1_IONProc/src/WH_ION_Gather.h
+++ b/Appl/CEP/CS1/CS1_IONProc/src/OutputSection.h
@@ -1,4 +1,4 @@
-//#  WH_ION_Gather.h: simple processing on BG/L I/O nodes
+//#  OutputSection.h: Collects data from CNs and sends data to Storage
 //#
 //#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
 //#
@@ -18,13 +18,15 @@
 //#
 //#  $Id$
 
-#ifndef LOFAR_APPL_CEP_CS1_CS1_ION_PROC_WH_ION_GATHER_H
-#define LOFAR_APPL_CEP_CS1_CS1_ION_PROC_WH_ION_GATHER_H
+#ifndef LOFAR_APPL_CEP_CS1_CS1_ION_PROC_OUTPUT_SECTION_H
+#define LOFAR_APPL_CEP_CS1_CS1_ION_PROC_OUTPUT_SECTION_H
 
-#include <CS1_Interface/DH_Visibilities.h>
-#include <tinyCEP/WorkHolder.h>
+#include <CS1_Interface/CorrelatedData.h>
+#include <CS1_Interface/CS1_Parset.h>
+#include <CS1_Interface/Queue.h>
 #include <Stream/Stream.h>
-#include <APS/ParameterSet.h>
+
+#include <pthread.h>
 
 #include <vector>
 
@@ -32,35 +34,36 @@
 namespace LOFAR {
 namespace CS1 {
 
-class WH_ION_Gather : public WorkHolder
+class OutputSection
 {
   public:
-	     WH_ION_Gather(const string &name, unsigned psetNumber, const CS1_Parset *ps, const std::vector<Stream *> &clientStreams);
-    virtual  ~WH_ION_Gather();
-
-    //static WorkHolder *construct(const string &name, const ACC::APS::ParameterSet &);
-    virtual WH_ION_Gather *make(const string &name);
+    OutputSection(unsigned psetNumber, const std::vector<Stream *> &streamsFromCNs);
+   ~OutputSection();
 
-    virtual void preprocess();
-    virtual void process();
-    virtual void postprocess();
+    void			preprocess(const CS1_Parset *);
+    void			process();
+    void			postprocess();
 
   private:
-    // forbid copy constructor
-    WH_ION_Gather(const WH_ION_Gather &);
+    static void			*sendThreadStub(void *);
+    void			sendThread();
+    void			connectToStorage(const CS1_Parset *);
 
-    // forbid assignment
-    WH_ION_Gather &operator = (const WH_ION_Gather &);
+    static const unsigned	maxSendQueueSize = 3;
 
-    vector<DH_Visibilities *>	itsSumDHs;
-    DH_Visibilities		*itsTmpDH;
+    Arena			*itsArena;
+    std::vector<CorrelatedData *> itsVisibilitySums;
+    CorrelatedData		*itsTmpSum;
+    Queue<CorrelatedData *>	itsFreeQueue, itsSendQueue;
 
     unsigned			itsPsetNumber, itsNrComputeCores, itsCurrentComputeCore;
     unsigned			itsNrSubbandsPerPset, itsCurrentSubband;
     unsigned			itsNrIntegrationSteps, itsCurrentIntegrationStep;
 
-    const CS1_Parset		*itsPS;
-    const std::vector<Stream *> &itsClientStreams;
+    const std::vector<Stream *> &itsStreamsFromCNs;
+    Stream			*itsStreamToStorage;
+
+    pthread_t			itsSendThread;
 };
 
 }
diff --git a/Appl/CEP/CS1/CS1_IONProc/src/WH_ION_Gather.cc b/Appl/CEP/CS1/CS1_IONProc/src/WH_ION_Gather.cc
deleted file mode 100644
index eb91349e39cafbcb28630827654f6f18a14d0228..0000000000000000000000000000000000000000
--- a/Appl/CEP/CS1/CS1_IONProc/src/WH_ION_Gather.cc
+++ /dev/null
@@ -1,172 +0,0 @@
-//#  WH_ION_Gather.cc: Blue Gene processing for 1 second of sampled data
-//#
-//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
-//#
-//#  This program is free software; you can redistribute it and/or modify
-//#  it under the terms of the GNU General Public License as published by
-//#  the Free Software Foundation; either version 2 of the License, or
-//#  (at your option) any later version.
-//#
-//#  This program is distributed in the hope that it will be useful,
-//#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//#  GNU General Public License for more details.
-//#
-//#  You should have received a copy of the GNU General Public License
-//#  along with this program; if not, write to the Free Software
-//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-//#
-//#  $Id$
-
-//# Always #include <lofar_config.h> first!
-#include <lofar_config.h>
-
-#include <CS1_Interface/BGL_Mapping.h>
-#include <ION_Allocator.h>
-#include <WH_ION_Gather.h>
-#include <TH_ZoidServer.h>
-
-#include <cstring>
-#include <string>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-
-namespace LOFAR {
-namespace CS1 {
-
-WH_ION_Gather::WH_ION_Gather(const string &name, unsigned psetNumber, const CS1_Parset *ps, const std::vector<Stream *> &clientStreams)
-:
-  WorkHolder(0, 1, name, "WH_ION_Gather"),
-  itsPsetNumber(psetNumber),
-  itsPS(ps),
-  itsClientStreams(clientStreams)
-{
-  itsTmpDH		    = 0;
-  itsNrComputeCores	    = ps->nrCoresPerPset();
-  itsCurrentComputeCore	    = 0;
-  itsNrSubbandsPerPset	    = ps->nrSubbandsPerPset();
-  itsCurrentSubband	    = 0;
-  itsNrIntegrationSteps     = ps->IONintegrationSteps();
-  itsCurrentIntegrationStep = 0;
-
-  TinyDataManager &dm = getDataManager();
-  DH_Visibilities *dh = new DH_Visibilities("output", ps);
-  dh->setAllocationProperties(false, BlobStringType(false, ION_Allocator()));
-  dm.addOutDataHolder(0, dh);
-  dm.setAutoTriggerOut(0, false);
-
-#if 0
-  for (unsigned i = 0; i < itsNrComputeCores; i ++) {
-    dm.addInDataHolder(i, new DH_Visibilities("input", ps));
-    dm.setAutoTriggerIn(i, false);
-  }
-#endif
-}
-
-
-WH_ION_Gather::~WH_ION_Gather()
-{
-}
-
-
-#if 0
-WorkHolder* WH_ION_Gather::construct(const string &name, const ACC::APS::ParameterSet &ps)
-{
-  return new WH_ION_Gather(name, ps);
-}
-#endif
-
-
-WH_ION_Gather* WH_ION_Gather::make(const string &name)
-{
-  return new WH_ION_Gather(name, itsPsetNumber, itsPS, itsClientStreams);
-}
-
-
-void WH_ION_Gather::preprocess()
-{
-  if (itsNrIntegrationSteps > 1)
-    for (unsigned subband = 0; subband < itsNrSubbandsPerPset; subband ++) {
-      DH_Visibilities *dh = new DH_Visibilities("sum", itsPS);
-      dh->setAllocationProperties(false, BlobStringType(false, ION_Allocator()));
-      dh->init();
-      itsSumDHs.push_back(dh);
-    }
-
-  itsTmpDH = new DH_Visibilities("tmp", itsPS);
-  itsTmpDH->setAllocationProperties(false, BlobStringType(false, ION_Allocator()));
-  itsTmpDH->init();
-}
-
-
-#if 0
-static double getTime()
-{
-  struct timeval tv;
-  static double  first_time = 0.0;
-
-  if (gettimeofday(&tv, 0) != 0) {
-    perror("gettimeofday");
-    tv.tv_sec = tv.tv_usec = 0;
-  }
-
-  double time = tv.tv_sec + tv.tv_usec / 1.0e6;
-
-  if (first_time == 0)
-    first_time = time;
-
-  return time - first_time;
-}
-#endif
-
-
-void WH_ION_Gather::process()
-{
-  bool firstTime = itsCurrentIntegrationStep == 0;
-  bool lastTime  = itsCurrentIntegrationStep == itsNrIntegrationSteps - 1;
-
-  //std::clog << "itsCurrentComputeCore = " << itsCurrentComputeCore << ", itsCurrentSubband = " << itsCurrentSubband << ", itsCurrentIntegrationStep = " << itsCurrentIntegrationStep << ", firstTime = " << firstTime << ", lastTime = " << lastTime << std::endl;
-  DH_Visibilities *dh = lastTime ? dynamic_cast<DH_Visibilities *>(getDataManager().getOutHolder(0)) : firstTime ? itsSumDHs[itsCurrentSubband] : itsTmpDH;
-  
-  unsigned channel = BGL_Mapping::mapCoreOnPset(itsCurrentComputeCore, itsPsetNumber);
-  //itsClientStreams[channel]->read(dh->getDataPtr(), (dh->getDataSize() + 31) & ~31);
-  itsClientStreams[channel]->read(dh->getVisibilities().origin(), dh->getVisibilities().num_elements() * sizeof(fcomplex));
-  itsClientStreams[channel]->read(dh->getNrValidSamples().origin(), dh->getNrValidSamples().num_elements() * sizeof(unsigned short));
-
-  if (!firstTime)
-    if (lastTime)
-      *dh += *itsSumDHs[itsCurrentSubband];
-    else
-      *itsSumDHs[itsCurrentSubband] += *itsTmpDH;
-
-  if (lastTime)
-    getDataManager().readyWithOutHolder(0);
-
-  if (++ itsCurrentComputeCore == itsNrComputeCores)
-    itsCurrentComputeCore = 0;
-
-  if (++ itsCurrentSubband == itsNrSubbandsPerPset) {
-    itsCurrentSubband = 0;
-
-    if (++ itsCurrentIntegrationStep == itsNrIntegrationSteps)
-      itsCurrentIntegrationStep = 0;
-  }
-}
-
-
-void WH_ION_Gather::postprocess()
-{
-  for (unsigned subband = 0; subband < itsSumDHs.size(); subband ++)
-    delete itsSumDHs[subband];
-
-  itsSumDHs.resize(0);
-  delete itsTmpDH;
-}
-
-}
-}
diff --git a/Appl/CEP/CS1/CS1_Interface/configure.in b/Appl/CEP/CS1/CS1_Interface/configure.in
index 503f193ee7e2d3535d8ddf8868e3e6034445a751..a2c1bf385199a6005232a90e9787a598e1e6050b 100644
--- a/Appl/CEP/CS1/CS1_Interface/configure.in
+++ b/Appl/CEP/CS1/CS1_Interface/configure.in
@@ -54,11 +54,11 @@ lofar_GENERAL
 lofar_MPI
 
 lofar_INTERNAL(LCS/Common,Common,,1,Common/LofarTypedefs.h,,)
-lofar_INTERNAL(LCS/Transport,Transport,,1,Transport/DataHolder.h,,)
+dnl lofar_INTERNAL(LCS/Transport,Transport,,1,Transport/DataHolder.h,,)
 lofar_INTERNAL(LCS/Stream,Stream,,1,Stream/Stream.h,,)
 lofar_INTERNAL(LCS/ACC/APS,APS,,0,APS/ParameterSet.h,,)
 lofar_INTERNAL(Appl/ApplCommon,ApplCommon,,1,ApplCommon/Observation.h,,)
-lofar_INTERNAL(CEP/tinyCEP,tinyCEP,,0,tinyCEP/TinyDataManager.h,,)
+dnl lofar_INTERNAL(CEP/tinyCEP,tinyCEP,,0,tinyCEP/TinyDataManager.h,,)
 lofar_EXTERNAL(boost,1,boost/date_time/date.hpp,"")
 
 dnl lofar_BLITZ
diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/CS1_Parset.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/CS1_Parset.h
index 58c14b6f064e62985235b57f23ea9578f79a141c..3160d1d84ac99fceacfc5027a85ec20192e70361 100644
--- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/CS1_Parset.h
+++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/CS1_Parset.h
@@ -68,6 +68,7 @@ public:
 	double         startTime() const;
 	double         stopTime() const;
 	uint32	       nrStations() const;
+	uint32	       nrBaselines() const;
 	double         sampleRate() const;
 	double         sampleDuration() const;
 	vector<double> positions() const;
@@ -172,6 +173,13 @@ inline uint32 CS1_Parset::nrStations() const
   return getStringVector("OLAP.storageStationNames").size();
 } 
   
+inline uint32 CS1_Parset::nrBaselines() const
+{
+  unsigned stations = nrStations();
+
+  return stations * (stations + 1) / 2;
+} 
+  
 inline double CS1_Parset::sampleRate() const
 {
   return getUint32("Observation.sampleClock") * 1000000.0 / 1024;
diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/CorrelatedData.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/CorrelatedData.h
similarity index 65%
rename from Appl/CEP/CS1/CS1_BGLProc/src/CorrelatedData.h
rename to Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/CorrelatedData.h
index f86004ece15f67352f86db7a2daa8f0a6fac2bb0..192361e340a34df0af590c95122907c9103cc334 100644
--- a/Appl/CEP/CS1/CS1_BGLProc/src/CorrelatedData.h
+++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/CorrelatedData.h
@@ -2,11 +2,13 @@
 #define LOFAR_APPL_CEP_CS1_CS1_BGL_PROC_CORRELATED_DATA_H
 
 #include <Common/lofar_complex.h>
-#include <CS1_Interface/CS1_Config.h>
+#include <Common/DataConvert.h>
 #include <CS1_Interface/Allocator.h>
+#include <CS1_Interface/CS1_Config.h>
 #include <Stream/Stream.h>
 
 #include <boost/multi_array.hpp>
+#include <stdexcept>
 
 
 namespace LOFAR {
@@ -19,8 +21,11 @@ class CorrelatedData
     ~CorrelatedData();
 
     static size_t requiredSize(unsigned nrBaselines);
+    void	  read(Stream *);
     void	  write(Stream *) const;
 
+    CorrelatedData &operator += (const CorrelatedData &);
+
   private:
     SparseSetAllocator	  allocator;
     unsigned	  itsNrBaselines;
@@ -31,6 +36,8 @@ class CorrelatedData
     float				      *centroids; //[itsNrBaselines]
 
   private:
+    void	  checkEndianness();
+
     static size_t visibilitiesSize(unsigned nrBaselines);
     static size_t nrValidSamplesSize(unsigned nrBaselines);
     static size_t centroidSize(unsigned nrBaselines);
@@ -81,14 +88,62 @@ inline CorrelatedData::~CorrelatedData()
 }
 
 
+inline void CorrelatedData::read(Stream *str)
+{
+  str->read(visibilities.origin(), visibilities.num_elements() * sizeof(fcomplex));
+  str->read(nrValidSamples.origin(), nrValidSamples.num_elements() * sizeof(unsigned short));
+  //str->read(centroids, itsNrBaselines * sizeof(float));
+
+  checkEndianness();
+}
+
+
 inline void CorrelatedData::write(Stream *str) const
 {
+#if !defined WORDS_BIGENDIAN
+  throw std::logic_error("not implemented: think about endianness");
+#endif
+
   str->write(visibilities.origin(), visibilities.num_elements() * sizeof(fcomplex));
   str->write(nrValidSamples.origin(), nrValidSamples.num_elements() * sizeof(unsigned short));
   //str->write(centroids, itsNrBaselines * sizeof(float));
 }
 
 
+inline void CorrelatedData::checkEndianness()
+{
+#if !defined WORDS_BIGENDIAN
+  dataConvert(LittleEndian, visibilities.origin(), visibilities.num_elements());
+  dataConvert(LittleEndian, nrValidSamples.origin(), nrValidSamples.num_elements());
+  // dataConvert(LittleEndian, centroids, itsNrBaselines);
+#endif
+}
+
+
+inline CorrelatedData &CorrelatedData::operator += (const CorrelatedData &other)
+{
+  // add visibilities
+  {
+    fcomplex	 *dst	= visibilities.origin();
+    const fcomplex *src	= other.visibilities.origin();
+    unsigned	 count	= visibilities.num_elements();
+
+    for (unsigned i = 0; i < count; i ++)
+      dst[i] += src[i];
+  }
+
+  // add nr. valid samples
+  {
+    unsigned short       *dst  = nrValidSamples.origin();
+    const unsigned short *src  = other.nrValidSamples.origin();
+    unsigned		 count = nrValidSamples.num_elements();
+
+    for (unsigned i = 0; i < count; i ++)
+      dst[i] += src[i];
+  }
+
+  return *this;
+}
 
 } // namespace CS1
 } // namespace LOFAR
diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_Visibilities.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_Visibilities.h
deleted file mode 100644
index 90a8778acd533b260aba73fb197ae27e84da0228..0000000000000000000000000000000000000000
--- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_Visibilities.h
+++ /dev/null
@@ -1,120 +0,0 @@
-//# DH_Visibilities.h: Visibilities DataHolder
-//#
-//#  Copyright (C) 2006
-//#  ASTRON (Netherlands Foundation for Research in Astronomy)
-//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
-//#
-//#  This program is free software; you can redistribute it and/or modify
-//#  it under the terms of the GNU General Public License as published by
-//#  the Free Software Foundation; either version 2 of the License, or
-//#  (at your option) any later version.
-//#
-//#  This program is distributed in the hope that it will be useful,
-//#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//#  GNU General Public License for more details.
-//#
-//#  You should have received a copy of the GNU General Public License
-//#  along with this program; if not, write to the Free Software
-//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-//#
-//#  $Id$
-
-#ifndef LOFAR_CS1_INTERFACE_DH_VISIBILITIES_H
-#define LOFAR_CS1_INTERFACE_DH_VISIBILITIES_H
-
-#if defined HAVE_APS
-
-#include <Transport/DataHolder.h>
-#include <Common/lofar_complex.h>
-#include <CS1_Interface/CS1_Config.h>
-#include <CS1_Interface/CS1_Parset.h>
-
-#if defined HAVE_BOOST
-#include <boost/multi_array.hpp>
-#endif
-
-namespace LOFAR {
-namespace CS1 {
-
-class DH_Visibilities: public DataHolder
-{
-  public:
-    typedef fcomplex	   VisibilityType;
-    typedef unsigned short NrValidSamplesType;
-    typedef float	   CentroidType;
-
-    explicit DH_Visibilities(const string& name,
-			     const CS1_Parset *pSet);
-
-    DH_Visibilities(const DH_Visibilities&);
-
-    virtual ~DH_Visibilities();
-
-    DataHolder* clone() const;
-
-    /// Allocate the buffers.
-    virtual void init();
-
-    static int baseline(int station1, int station2)
-    {
-      DBGASSERT(station1 <= station2);
-      return station2 * (station2 + 1) / 2 + station1;
-    }
-
-    typedef boost::multi_array_ref<VisibilityType, 4>	  VisibilitiesType;
-    typedef boost::multi_array_ref<NrValidSamplesType, 2> AllNrValidSamplesType;
-
-    VisibilitiesType getVisibilities() const
-    {
-      static boost::detail::multi_array::extent_gen<4u> extents = boost::extents[itsNrBaselines][itsNrChannels][NR_POLARIZATIONS][NR_POLARIZATIONS];
-      return VisibilitiesType(itsVisibilities, extents);
-    }
-
-    AllNrValidSamplesType getNrValidSamples() const
-    {
-      static boost::detail::multi_array::extent_gen<2u> extents = boost::extents[itsNrBaselines][itsNrChannels];
-      return AllNrValidSamplesType(itsNrValidSamples, extents);
-    }
-
-    VisibilityType &getVisibility(unsigned baseline, unsigned channel, unsigned pol1, unsigned pol2)
-    {
-      return itsVisibilities[NR_POLARIZATIONS * (NR_POLARIZATIONS * (itsNrChannels * baseline + channel) + pol1) + pol2];
-    }
-
-    NrValidSamplesType &getNrValidSamples(unsigned baseline, unsigned channel)
-    {
-      return itsNrValidSamples[itsNrChannels * baseline + channel];
-    }
-
-    const size_t getNrVisibilities() const
-    {
-      return itsNrBaselines * itsNrChannels * NR_POLARIZATIONS * NR_POLARIZATIONS;
-    }
-
-    CentroidType *getCentroids()
-    {
-      return itsCentroids;
-    }
-
-    DH_Visibilities &operator += (const DH_Visibilities &);
-
-  private:
-    /// Forbid assignment.
-    DH_Visibilities& operator= (const DH_Visibilities&);
-
-    const CS1_Parset   *itsCS1PS;
-    unsigned	       itsNrBaselines, itsNrChannels;
-
-    VisibilityType     *itsVisibilities;
-    NrValidSamplesType *itsNrValidSamples;
-    CentroidType       *itsCentroids;
-
-    void fillDataPointers();
-};
-
-} // namespace CS1
-} // namespace LOFAR
-
-#endif // defined HAVE_APS
-#endif 
diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Makefile.am b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Makefile.am
index a067287cd2ba74e65729682e8b18d73498bec379..a8f794f40a9ef2e082b7e03531e8f70eade5ea5f 100644
--- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Makefile.am
+++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Makefile.am
@@ -4,11 +4,13 @@ pkginclude_HEADERS = Package__Version.h \
 		     BGL_Command.h \
 		     BGL_Configuration.h \
 		     BGL_Mapping.h \
+		     CorrelatedData.h \
 		     CS1_Config.h \
 		     CS1_Parset.h \
 		     DH_Visibilities.h \
 		     SubbandMetaData.h \
 		     PrintVector.h \
+		     Queue.h \
 		     RSPTimeStamp.h \
 		     SparseSet.h \
 		     Stub_BGL.h 
diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RSPTimeStamp.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RSPTimeStamp.h
index e7a097166584beebd4319110f429e18ea9ba15c7..9ead1384492e917589bef16f92bf344664a5beae 100644
--- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RSPTimeStamp.h
+++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RSPTimeStamp.h
@@ -24,18 +24,12 @@
 #define LOFAR_CS1_INTERFACE_RSPTIMESTAMP_H
 
 #include <Common/lofar_iosfwd.h>
-#include <Common/DataConvert.h>
+#include <Common/LofarTypes.h>
+
 
 #define EVEN_SECOND_HAS_MORE_SAMPLES
 
 namespace LOFAR {
-
-  // This is needed to be able to put the TimeStamp in a Blob
-  namespace CS1 {
-    class TimeStamp;
-  }
-  void dataConvert(DataFormat fmt, CS1::TimeStamp* inout, uint nrval);
-
   namespace CS1 {
 
     class TimeStamp {
@@ -72,26 +66,11 @@ namespace LOFAR {
 
       friend ostream &operator << (ostream &os, const TimeStamp &ss);
 
-      // This is needed to be able to put the TimeStamp in a Blob
-      friend void ::LOFAR::dataConvert(DataFormat fmt, TimeStamp* inout, uint nrval);
-
     protected:
       int64	    itsTime;
       static double theirMaxBlockId, theirInvMaxBlockId;
     };
 
-  } // namespace CS1
-
-  // This is needed to be able to put the TimeStamp in a Blob
-  inline void dataConvert(DataFormat fmt, CS1::TimeStamp* inout, uint nrval)
-    {
-      for (uint i=0; i<nrval ;i++) {
- 	dataConvert64(fmt, &(inout[i].itsTime));
-      }
-    }
-
-  namespace CS1 {
-
     typedef TimeStamp timestamp_t;
 
     inline TimeStamp::TimeStamp(int64 time)
diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/SparseSet.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/SparseSet.h
index c9b5a264cb4821375abb7bf68c194b062d3dbc49..ad4a082952b9ed621f2dca1bf7c4bbf9d6c3a51b 100644
--- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/SparseSet.h
+++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/SparseSet.h
@@ -24,8 +24,7 @@
 #ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_BITSET_H
 #define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_BITSET_H
 
-#include <Blob/BlobOStream.h>
-#include <Blob/BlobIStream.h>
+#include <sys/types.h>
 
 #include <algorithm>
 #include <cassert>
@@ -67,9 +66,6 @@ template <typename T> class SparseSet {
 
     const Ranges &getRanges() const;
 
-    void write(BlobOStream &) const;
-    void read(BlobIStream &);
-
     ssize_t marshall(void *ptr, size_t maxSize) const;
     void    unmarshall(const void *ptr);
 
@@ -265,36 +261,15 @@ template <typename T> SparseSet<T> &SparseSet<T>::operator -= (size_t count)
 }
 
 
-template <typename T> void SparseSet<T>::write(BlobOStream &bos) const
-{
-  bos << (uint32) ranges.size();
-
-  for (const_iterator it = ranges.begin(); it != ranges.end(); it ++)
-    bos << it->begin << it->end;
-}
-
-
-template <typename T> void SparseSet<T>::read(BlobIStream &bis)
-{
-  uint32 size;
-
-  bis >> size;
-  ranges.resize(size);
-
-  for (iterator it = ranges.begin(); it != ranges.end(); it ++)
-    bis >> it->begin >> it->end;
-}
-
-
 template <typename T> ssize_t SparseSet<T>::marshall(void *ptr, size_t maxSize) const
 {
-  size_t size = sizeof(uint32) + ranges.size() * sizeof(range);
+  size_t size = sizeof(uint32_t) + ranges.size() * sizeof(range);
 
   if (size > maxSize)
     return -1;
 
-  * (uint32 *) ptr = ranges.size();
-  memcpy((uint32 *) ptr + 1, &ranges[0], ranges.size() * sizeof(range));
+  * (uint32_t *) ptr = ranges.size();
+  memcpy((uint32_t *) ptr + 1, &ranges[0], ranges.size() * sizeof(range));
 
   return size;
 }
@@ -302,8 +277,8 @@ template <typename T> ssize_t SparseSet<T>::marshall(void *ptr, size_t maxSize)
 
 template <typename T> void SparseSet<T>::unmarshall(const void *ptr)
 {
-  ranges.resize(* (uint32 *) ptr);
-  memcpy(&ranges[0], (uint32 *) ptr + 1, ranges.size() * sizeof(range));
+  ranges.resize(* (uint32_t *) ptr);
+  memcpy(&ranges[0], (uint32_t *) ptr + 1, ranges.size() * sizeof(range));
 }
 
 
diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL.h
deleted file mode 100644
index 8847a51cb146f39af0e560cbbabcb44c715bd227..0000000000000000000000000000000000000000
--- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL.h
+++ /dev/null
@@ -1,60 +0,0 @@
-//# Stub_BGL.h: Stub for connection of BGL with outside world
-//#
-//#  Copyright (C) 2006
-//#  ASTRON (Netherlands Foundation for Research in Astronomy)
-//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
-//#
-//#  This program is free software; you can redistribute it and/or modify
-//#  it under the terms of the GNU General Public License as published by
-//#  the Free Software Foundation; either version 2 of the License, or
-//#  (at your option) any later version.
-//#
-//#  This program is distributed in the hope that it will be useful,
-//#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//#  GNU General Public License for more details.
-//#
-//#  You should have received a copy of the GNU General Public License
-//#  along with this program; if not, write to the Free Software
-//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-//#
-//#  $Id$
-
-#ifndef LOFAR_CS1_INTERFACE_STUB_BGL_H
-#define LOFAR_CS1_INTERFACE_STUB_BGL_H
-
-#include <tinyCEP/TinyDataManager.h>
-#include <Transport/Connection.h>
-#include <Transport/TransportHolder.h>
-#include <CS1_Interface/CS1_Parset.h>
-
-#include <map>
-#include <string>
-
-namespace LOFAR {
-namespace CS1 {
-
-class Stub_BGL
-{
-  // This is a base class that can be used to make connections from the BGL
-  // application to the outside world.  Details are filled in by derived
-  // classes that must provide the necessary TransportHolders.
-
-  public:
-    Stub_BGL(bool iAmOnBGL, bool isInput, const char *connectionName, const CS1_Parset *pSet);
-    ~Stub_BGL();
-
-    void connect(unsigned psetNr, unsigned coreNr, TinyDataManager &dm, unsigned channel);
-
-  private:
-    const CS1_Parset				     *itsCS1PS;
-    bool					     itsIAmOnBGL, itsIsInput;
-    string					     itsPrefix;
-    map<pair<unsigned, unsigned>, TransportHolder *> itsTHs;
-    map<pair<unsigned, unsigned>, Connection *>      itsConnections;
-};
-
-} // namespace CS1
-} // namespace LOFAR
-
-#endif
diff --git a/Appl/CEP/CS1/CS1_Interface/src/DH_Visibilities.cc b/Appl/CEP/CS1/CS1_Interface/src/DH_Visibilities.cc
deleted file mode 100644
index 12835b7a4db693005af026264e453955da877636..0000000000000000000000000000000000000000
--- a/Appl/CEP/CS1/CS1_Interface/src/DH_Visibilities.cc
+++ /dev/null
@@ -1,152 +0,0 @@
-//#  DH_Visibilities.cc:
-//#
-//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
-//#
-//#  This program is free software; you can redistribute it and/or modify
-//#  it under the terms of the GNU General Public License as published by
-//#  the Free Software Foundation; either version 2 of the License, or
-//#  (at your option) any later version.
-//#
-//#  This program is distributed in the hope that it will be useful,
-//#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//#  GNU General Public License for more details.
-//#
-//#  You should have received a copy of the GNU General Public License
-//#  along with this program; if not, write to the Free Software
-//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-//#
-//#  $Id$
-
-#include <lofar_config.h>
-
-#if defined HAVE_APS
-
-#include <CS1_Interface/DH_Visibilities.h>
-#include <Common/Timer.h>
-
-namespace LOFAR {
-namespace CS1 {
-
-DH_Visibilities::DH_Visibilities(const string &name, const CS1_Parset *pSet)
-: DataHolder(name, "DH_Visibilities"),
-  itsCS1PS  (pSet),
-  itsVisibilities(0),
-  itsNrValidSamples(0),
-  itsCentroids(0)
-{
-  itsNrChannels       = itsCS1PS->nrChannelsPerSubband();
-  unsigned nrStations = itsCS1PS->nrStations();
-  itsNrBaselines      = nrStations * (nrStations + 1) / 2;
-}   
-
-
-DH_Visibilities::DH_Visibilities(const DH_Visibilities &that)
-: DataHolder(that),
-  itsCS1PS(that.itsCS1PS),
-  itsNrBaselines(that.itsNrBaselines),
-  itsNrChannels(that.itsNrChannels),
-  itsVisibilities(0),
-  itsNrValidSamples(0),
-  itsCentroids(0)
-{
-}
-
-DH_Visibilities::~DH_Visibilities()
-{
-}
-
-DataHolder* DH_Visibilities::clone() const
-{
-  return new DH_Visibilities(*this);
-}
-
-void DH_Visibilities::init()
-{
-  addField("Visibilities",   BlobField<fcomplex>(1, getNrVisibilities()), 32);
-  addField("NrValidSamples", BlobField<NrValidSamplesType>(1, itsNrBaselines * itsNrChannels), 32);
-
-  unsigned alignedCentroidsSize = ((itsNrBaselines * sizeof(CentroidType) + 31) & ~31) / sizeof(CentroidType);
-  addField("Centroids",      BlobField<CentroidType>(1, alignedCentroidsSize), 32);
-
-  createDataBlock();  // calls fillDataPointers
-}
-
-
-#if 0
-// TODO: add nrValidSamples
-
-extern "C" { void do_add(fcomplex *, const fcomplex *, unsigned); }
-
-asm(
-"do_add:\n"
-"	.long 0x7c001b1c\n"	// lfpsx   0,0,3
-"	li      8,8\n"
-"	.long 0x7c20231c\n"	// lfpsx   1,0,4
-"	addi    9,3,-8\n"
-"	.long 0x7c43435c\n"	// lfpsux  2,3,8
-"	rlwinm  5,5,30,2,31\n"
-"	.long 0x7c64435c\n"	// lfpsux  3,4,8
-"	mtctr   5\n"
-"	.long 0x7c83435c\n"	// lfpsux  4,3,8
-"	li	10,64\n"
-"	.long 0x7ca4435c\n"	// lfpsux  5,4,8
-"	.long 0x7cc3435c\n"	// lfpsux  6,3,8
-"	.long 0x7ce4435c\n"	// lfpsux  7,4,8
-"0:\n"
-"	.long 0x01000818\n"	// fpadd   8,0,1
-"	.long 0x7c03435c\n"	// lfpsux  0,3,8
-"	.long 0x01221818\n"	// fpadd   9,2,3
-"	.long 0x7c24435c\n"	// lfpsux  1,4,8
-"	.long 0x01442818\n"	// fpadd   10,4,5
-"	.long 0x7c43435c\n"	// lfpsux  2,3,8
-"	.long 0x01663818\n"	// fpadd   11,6,7
-"	.long 0x7c64435c\n"	// lfpsux  3,4,8
-"	.long 0x7c83435c\n"	// lfpsux  4,3,8
-"	.long 0x7d09475c\n"	// stfpsux 8,9,8
-"	.long 0x7ca4435c\n"	// lfpsux  5,4,8
-"	.long 0x7d29475c\n"	// stfpsux 9,9,8
-"	.long 0x7cc3435c\n"	// lfpsux  6,3,8
-"	.long 0x7d49475c\n"	// stfpsux 10,9,8
-"	.long 0x7ce4435c\n"	// lfpsux  7,4,8
-"	.long 0x7d69475c\n"	// stfpsux 11,9,8
-"	bdnz+   0b\n"
-"	blr\n"
-);
-#endif
-
-
-DH_Visibilities &DH_Visibilities::operator += (const DH_Visibilities &dh)
-{
-  //NSTimer timer("DH_Vis add", true);
-  //timer.start();
-
-#if 1
-  for (unsigned i = 0; i < getNrVisibilities(); i ++)
-    itsVisibilities[i] += dh.itsVisibilities[i];
-
-  for (unsigned i = 0; i < itsNrBaselines * itsNrChannels; i ++)
-    itsNrValidSamples[i] += dh.itsNrValidSamples[i];
-
-  for (unsigned i = 0; i < itsNrBaselines; i ++) {
-    // add centroids here
-  }
-#else
-  do_add(itsVisibilities, dh.itsVisibilities, getNrVisibilities());
-#endif
-
-  //timer.stop();
-  return *this;
-}
-
-void DH_Visibilities::fillDataPointers() 
-{
-  itsVisibilities   = (VisibilityType *)     getData<fcomplex>("Visibilities");
-  itsNrValidSamples = (NrValidSamplesType *) getData<NrValidSamplesType>("NrValidSamples");
-  itsCentroids      = (CentroidType *)      getData<CentroidType>("Centroids");
-}
-
-} // namespace CS1
-} // namespace LOFAR
-
-#endif // defined HAVE_APS
diff --git a/Appl/CEP/CS1/CS1_Interface/src/Makefile.am b/Appl/CEP/CS1/CS1_Interface/src/Makefile.am
index 763275d02306315452a6b13a40915b07f634f296..a068a0fb8fdbdc0a49e25c9ea87c0c66003de616 100644
--- a/Appl/CEP/CS1/CS1_Interface/src/Makefile.am
+++ b/Appl/CEP/CS1/CS1_Interface/src/Makefile.am
@@ -5,9 +5,7 @@ libcs1_interface_la_SOURCES	= Package__Version.cc \
 				  BGL_Configuration.cc \
 				  BGL_Mapping.cc \
 				  CS1_Parset.cc \
-				  DH_Visibilities.cc \
-				  RSPTimeStamp.cc \
-				  Stub_BGL.cc 
+				  RSPTimeStamp.cc
 
 configfilesdir			= $(bindir)
 
diff --git a/Appl/CEP/CS1/CS1_Interface/src/RSPTimeStamp.cc b/Appl/CEP/CS1/CS1_Interface/src/RSPTimeStamp.cc
index d796e2c74e74f68100933c1f858adea282c29e19..8c6a06bf4609bf729295bcbd1f9bcff23f130ff6 100644
--- a/Appl/CEP/CS1/CS1_Interface/src/RSPTimeStamp.cc
+++ b/Appl/CEP/CS1/CS1_Interface/src/RSPTimeStamp.cc
@@ -22,7 +22,6 @@
 
 #include <CS1_Interface/RSPTimeStamp.h>
 #include <Common/lofar_iostream.h>
-#include <Blob/BlobField.tcc>
 
 namespace LOFAR {
   namespace CS1 {
@@ -35,8 +34,4 @@ namespace LOFAR {
     }
 
   } // namespace CS1
-
-  // This is needed to be able to put the TimeStamp in a Blob
-  template class BlobField<CS1::TimeStamp>;
-
 } // namespace LOFAR
diff --git a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL.cc b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL.cc
deleted file mode 100644
index bc1ead4315a132e8d79d02e06cac484271c11a44..0000000000000000000000000000000000000000
--- a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL.cc
+++ /dev/null
@@ -1,101 +0,0 @@
-//# Stub_BGL.cc: Base class for BG/L stubs
-//#
-//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
-//#
-//#  This program is free software; you can redistribute it and/or modify
-//#  it under the terms of the GNU General Public License as published by
-//#  the Free Software Foundation; either version 2 of the License, or
-//#  (at your option) any later version.
-//#
-//#  This program is distributed in the hope that it will be useful,
-//#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//#  GNU General Public License for more details.
-//#
-//#  You should have received a copy of the GNU General Public License
-//#  along with this program; if not, write to the Free Software
-//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-//#
-//#  $Id$
-
-#include <lofar_config.h>
-
-#if defined HAVE_TINYCEP && defined HAVE_APS
-
-#include <CS1_Interface/Stub_BGL.h>
-#include <Transport/BGLConnection.h>
-#include <Transport/TH_File.h>
-#include <Transport/TH_Null.h>
-#include <Transport/TH_Socket.h>
-
-#include <cstring>
-
-
-namespace LOFAR { 
-namespace CS1 {
-
-Stub_BGL::Stub_BGL(bool iAmOnBGL, bool isInput, const char *connectionName, const CS1_Parset *pSet)
-:
-  itsCS1PS(pSet),
-  itsIAmOnBGL(iAmOnBGL),
-  itsIsInput(isInput),
-  itsPrefix(string("OLAP.OLAP_Conn.") + connectionName)
-{
-}
-
-
-Stub_BGL::~Stub_BGL()
-{
-  for (map<pair<unsigned, unsigned>, TransportHolder *>::iterator it = itsTHs.begin(); it != itsTHs.end(); it ++)
-    delete it->second;
-
-  for (map<pair<unsigned, unsigned>, Connection *>::iterator it = itsConnections.begin(); it != itsConnections.end(); it ++)
-    delete it->second;
-}
-
-
-void Stub_BGL::connect(unsigned psetNr, unsigned coreNr, TinyDataManager &dm, unsigned channel)
-{
-  pair<unsigned, unsigned> index(psetNr, coreNr);
-
-  ASSERTSTR(itsTHs.find(index) == itsTHs.end(), "already connected: psetNr = " << psetNr << ", coreNr = " << coreNr);
-   
-  TransportHolder *th;
-  string transportType = itsCS1PS->getString(itsPrefix + "_Transport");
-
-  if (transportType == "TCP") {
-    string server  = itsCS1PS->getStringVector(itsPrefix + "_ServerHosts")[psetNr];
-    string service = itsCS1PS->getPortsOf(itsPrefix)[coreNr];
-    th = itsIAmOnBGL ? new TH_Socket(server, service, false, Socket::TCP, false) : new TH_Socket(service, false, Socket::TCP, 5, false);
-  } else if (transportType == "FILE") {
-    string baseFileName = itsCS1PS->getString(itsPrefix + "_BaseFileName");
-    char fileName[baseFileName.size() + 32];
-    sprintf(fileName, "%s.%u.%u", baseFileName.c_str(), psetNr, coreNr);
-    th = new TH_File(string(fileName), itsIsInput ? TH_File::Read : TH_File::Write);
-#if 0
-  } else if (transportType == "ZOID") {
-    th = itsIAmOnBGL ? TH_ZoidClient() : TH_ZoidServer(coreNr);
-#endif
-  } else if (transportType == "NULL") {
-    th = new TH_Null();
-  } else {
-    ASSERTSTR(false, transportType << ": unknown connector");
-  }
-
-  itsTHs[index] = th;
-
-  if (itsIsInput) {
-    Connection *conn = new BGLConnection("output", 0, dm.getGeneralInHolder(channel), th);
-    itsConnections[index] = conn;
-    dm.setInConnection(channel, conn);
-  } else {
-    Connection *conn = new BGLConnection("input", dm.getGeneralOutHolder(channel), 0, th);
-    itsConnections[index] = conn;
-    dm.setOutConnection(channel, conn);
-  }
-};
-
-} // namespace CS1
-} // namespace LOFAR
-
-#endif // defined HAVE_TINYCEP && defined HAVE_APS
diff --git a/Appl/CEP/CS1/CS1_Storage/configure.in b/Appl/CEP/CS1/CS1_Storage/configure.in
index 8f89bcded501df57fec090988822a1e60532bb8d..4b43ae13da779e4fd22930a06bad7ee358180dfe 100644
--- a/Appl/CEP/CS1/CS1_Storage/configure.in
+++ b/Appl/CEP/CS1/CS1_Storage/configure.in
@@ -56,11 +56,11 @@ lofar_MPI
 lofar_AIPSPP(0,"-lms -lmeasures -ltables -lscimath -lscimath_f -lcasa")
 
 lofar_INTERNAL(LCS/Common,Common,,1,Common/LofarTypedefs.h,,)
-lofar_INTERNAL(LCS/Transport,Transport,,1,Transport/DataHolder.h,,)
+dnl lofar_INTERNAL(LCS/Transport,Transport,,1,Transport/DataHolder.h,,)
 lofar_INTERNAL(LCS/AMC/AMCBase,AMCBase,,1,AMCBase/Epoch.h,,)
 lofar_INTERNAL(LCS/ACC/APS,APS,,1,APS/ParameterSet.h,,)
-lofar_INTERNAL(CEP/tinyCEP,tinyCEP,,1,tinyCEP/TinyDataManager.h,,)
-lofar_INTERNAL(CEP/CEPFrame,CEPFrame,,1,CEPFrame/DataManager.h,,)
+dnl lofar_INTERNAL(CEP/tinyCEP,tinyCEP,,1,tinyCEP/TinyDataManager.h,,)
+dnl lofar_INTERNAL(CEP/CEPFrame,CEPFrame,,1,CEPFrame/DataManager.h,,)
 lofar_INTERNAL(Appl/CEP/CS1/CS1_Interface,CS1_Interface,,1,CS1_Interface/DH_Visibilities.h,,)
 dnl The property interface is not used right now
 dnl lofar_INTERNAL(MAC/GCF/GCFCommon,GCFCommon,,1,GCF/GCF_PVString.h,gcfcommon)
diff --git a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/AHC_Storage.h b/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/AHC_Storage.h
deleted file mode 100644
index 55b6acec791ada4ce0b0e904d687d9d53dfae44f..0000000000000000000000000000000000000000
--- a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/AHC_Storage.h
+++ /dev/null
@@ -1,65 +0,0 @@
-//#  AHC_Storage.h: interpretes commands from ACC and executes
-//#                                 them on the TinyApplicationHolder object
-//#
-//#  Copyright (C) 2002-2004
-//#  ASTRON (Netherlands Foundation for Research in Astronomy)
-//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
-//#
-//#  This program is free software; you can redistribute it and/or modify
-//#  it under the terms of the GNU General Public License as published by
-//#  the Free Software Foundation; either version 2 of the License, or
-//#  (at your option) any later version.
-//#
-//#  This program is distributed in the hope that it will be useful,
-//#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//#  GNU General Public License for more details.
-//#
-//#  You should have received a copy of the GNU General Public License
-//#  along with this program; if not, write to the Free Software
-//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-//#
-//#  $Id$
-
-#ifndef AHC_STORAGE_H
-#define AHC_STORAGE_H
-
-// \file
-// Interprets commands from ACC and executes them on the TinyApplicationHolder
-// object
-
-#include <Common/LofarLogger.h>
-
-#include <tinyCEP/Profiler.h>
-
-#include <tinyCEP/ApplicationHolderController.h>
-
-namespace LOFAR { 
-  namespace CS1 {
-
-// \addtogroup tinyCEP
-// @{
-class AHC_Storage : public ApplicationHolderController
-{
-public:
-  // Default constructable
-  AHC_Storage(TinyApplicationHolder& stationCorrelator, int noRuns = 100);
-
-  // Destructor
-  ~AHC_Storage();
-/* todo: check this code during SAS/MAC tests
-  // Command to control the application processes.
-  tribool	pause    (const	string&	condition) ;
-  tribool	quit  	 ();
-*/  
-  
-protected:
-  // Copying is not allowed
-  AHC_Storage (const AHC_Storage& that);
-  AHC_Storage& 	operator=(const AHC_Storage& that);
-};
-
-// @}
-  }
-}  
-#endif
diff --git a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/AH_Storage.h b/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/AH_Storage.h
deleted file mode 100644
index 3a76f9292984728f19ba9102ec5c8ffd08a47cc5..0000000000000000000000000000000000000000
--- a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/AH_Storage.h
+++ /dev/null
@@ -1,49 +0,0 @@
-//#  AH_Storage.h: 
-//#
-//#  Copyright (C) 2002-2004
-//#  ASTRON (Netherlands Foundation for Research in Astronomy)
-//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
-//#
-//#  $Id$
-//#
-////////////////////////////////////////////////////////////////////
-
-#ifndef CS1_STORAGE_AH_STORAGE_H
-#define CS1_STORAGE_AH_STORAGE_H
-
-#include <CEPFrame/ApplicationHolder.h>
-#include <CS1_Interface/Stub_BGL.h>
-#include <CS1_Interface/CS1_Parset.h>
-
-namespace LOFAR
-{
-  namespace CS1
-  {
-
-    // This is the ApplicationHolder for the storage section of the CS1 application
-    // This applicationholder uses the CEPFrame library and is supposed to
-    // connect to the BGLProcessing application Holder (using only tinyCEP). 
-    // The interface between these is defined in  the Corr_Stub class.
-    // 
-    class AH_Storage: public LOFAR::ApplicationHolder
-    {
-    public:
-      AH_Storage();
-      virtual ~AH_Storage();
-      virtual void define  (const LOFAR::KeyValueMap&);
-      virtual void undefine();
-      virtual void prerun  ();
-      virtual void run     (int nsteps);
-      virtual void dump    () const;
-      virtual void quit    ();
-    private:
-      CS1_Parset       *itsCS1PS;
-      Stub_BGL         *itsStub;
-
-    };
-
-  } // namespace CS1
-
-} // namespace LOFAR
-
-#endif
diff --git a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/Makefile.am b/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/Makefile.am
index 7c23c1b4431e419f40176b2ce96486c73e1004c9..5870b882811390cf033bcb49992dfe8e7899ebb7 100644
--- a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/Makefile.am
+++ b/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/Makefile.am
@@ -3,6 +3,7 @@ pkginclude_HEADERS = Package__Version.h
 noinst_HEADERS =		\
 	AH_Storage.h		\
 	WH_SubbandWriter.h	\
+	SubbandWriter.h		\
 	MSWriter.h		\
 	MSWriterImpl.h
 
diff --git a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/SubbandWriter.h b/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/SubbandWriter.h
new file mode 100644
index 0000000000000000000000000000000000000000..f1c1c38871fa59d16fd00067fb0d830646864494
--- /dev/null
+++ b/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/SubbandWriter.h
@@ -0,0 +1,100 @@
+//#  SubbandWriter.h: Write subband(s) in an AIPS++ Measurement Set
+//#
+//#  Copyright (C) 2002-2005
+//#  ASTRON (Netherlands Foundation for Research in Astronomy)
+//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//#  This program is free software; you can redistribute it and/or modify
+//#  it under the terms of the GNU General Public License as published by
+//#  the Free Software Foundation; either version 2 of the License, or
+//#  (at your option) any later version.
+//#
+//#  This program is distributed in the hope that it will be useful,
+//#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//#  GNU General Public License for more details.
+//#
+//#  You should have received a copy of the GNU General Public License
+//#  along with this program; if not, write to the Free Software
+//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//#  $Id$
+
+#ifndef CS1_STORAGE_SUBBANDWRITER_H
+#define CS1_STORAGE_SUBBANDWRITER_H
+
+// \file
+// Write subband(s) in an AIPS++ Measurement Set
+
+#include <Blob/KeyValueMap.h>
+#include <CS1_Interface/CS1_Config.h>
+#ifdef USE_MAC_PI
+# include <GCF/PALlight/CEPPropertySet.h>
+# include <GCF/GCF_PVDynArr.h>
+#endif
+#include <Common/Timer.h>
+#include <Common/lofar_vector.h>
+#include <CS1_Interface/CS1_Parset.h>
+#include <CS1_Interface/CorrelatedData.h>
+#include <Stream/Stream.h>
+
+namespace LOFAR {
+namespace CS1 {
+
+class MSWriter;
+
+class SubbandWriter
+{
+  public:
+    SubbandWriter(const CS1_Parset *, unsigned rank);
+    ~SubbandWriter();
+
+    void preprocess();
+    void process();
+    void postprocess();
+
+  private:
+    void clearAllSums();
+    void createInputStreams();
+  
+    const CS1_Parset	  *itsCS1PS;
+    unsigned		  itsRank;
+
+    std::vector<Stream *> itsInputStreams;
+    Arena		  *itsArena;
+    CorrelatedData	  *itsCorrelatedData;
+
+    unsigned  itsNStations;
+    unsigned  itsNBaselines;
+    unsigned  itsNChannels;
+    unsigned  itsNBeams;
+    unsigned  itsNPolSquared;
+    unsigned  itsNVisibilities;
+
+    vector <MSWriter *> itsWriters;
+
+    unsigned itsNrSubbandsPerPset;
+    unsigned itsNrSubbandsPerStorage;
+
+    vector<unsigned> itsBandIDs;   ///< MS IDs of the frequency bands
+    unsigned itsTimeCounter;       ///< Counts the time
+    unsigned itsTimesToIntegrate;  ///< Number of timeSteps to integrate
+    bool *itsFlagsBuffers;//[NR_SUBBANDS][NR_BASELINES][NR_SUBBAND_CHANNELS][NR_POLARIZATIONS][NR_POLARIZATIONS];
+    float *itsWeightsBuffers;//[NR_SUBBANDS][NR_BASELINES][NR_SUBBAND_CHANNELS];
+    fcomplex *itsVisibilities;//[NR_SUBBANDS][NR_BASELINES][NR_SUBBAND_CHANNELS][NR_POLARIZATIONS][NR_POLARIZATIONS];
+
+    float itsWeightFactor;
+
+    NSTimer itsWriteTimer;
+
+#ifdef USE_MAC_PI
+    bool itsWriteToMAC;
+    GCF::CEPPMLlight::CEPPropertySet* itsPropertySet;
+    GCF::Common::GCFPValueArray itsVArray; 
+#endif
+};
+
+} // namespace CS1
+} // namespace LOFAR
+
+#endif
diff --git a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/WH_SubbandWriter.h b/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/WH_SubbandWriter.h
deleted file mode 100644
index 57ab243295b97834f3a6d94cb617f770fa4d02a1..0000000000000000000000000000000000000000
--- a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/WH_SubbandWriter.h
+++ /dev/null
@@ -1,113 +0,0 @@
-//#  WH_SubbandWriter.h: Write subband(s) in an AIPS++ Measurement Set
-//#
-//#  Copyright (C) 2002-2005
-//#  ASTRON (Netherlands Foundation for Research in Astronomy)
-//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
-//#
-//#  This program is free software; you can redistribute it and/or modify
-//#  it under the terms of the GNU General Public License as published by
-//#  the Free Software Foundation; either version 2 of the License, or
-//#  (at your option) any later version.
-//#
-//#  This program is distributed in the hope that it will be useful,
-//#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//#  GNU General Public License for more details.
-//#
-//#  You should have received a copy of the GNU General Public License
-//#  along with this program; if not, write to the Free Software
-//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-//#
-//#  $Id$
-
-#ifndef CS1_STORAGE_WH_SUBBANDWRITER_H
-#define CS1_STORAGE_WH_SUBBANDWRITER_H
-
-// \file
-// Write subband(s) in an AIPS++ Measurement Set
-
-#include <Blob/KeyValueMap.h>
-#include <tinyCEP/WorkHolder.h>
-#include <CS1_Interface/CS1_Config.h>
-#include <CS1_Interface/DH_Visibilities.h>
-#ifdef USE_MAC_PI
-# include <GCF/PALlight/CEPPropertySet.h>
-# include <GCF/GCF_PVDynArr.h>
-#endif
-#include <Common/Timer.h>
-#include <Common/lofar_vector.h>
-#include <CS1_Interface/CS1_Parset.h>
-
-namespace LOFAR
-{
-  namespace CS1
-  {
-    //# Forward declaration
-    class MSWriter;
-
-    class WH_SubbandWriter: public WorkHolder
-    {
-    public:
-
-      WH_SubbandWriter(const string& name,  const vector<uint>& subbandIDs,
-                             CS1_Parset *pset);
-
-      virtual ~WH_SubbandWriter();
-    
-      static WorkHolder* construct(const string& name,  
-                                   const vector<uint>& subbandIDs,
-				         CS1_Parset *pset);
-
-      virtual WH_SubbandWriter* make(const string& name);
-
-      void preprocess();
-
-      virtual void process();
-
-      void postprocess();
-    private:
-      /// forbid copy constructor
-      WH_SubbandWriter (const WH_SubbandWriter&);
-      /// forbid assignment
-      WH_SubbandWriter& operator= (const WH_SubbandWriter&);
-
-      // clear the integration buffers
-      void clearAllSums();
-      
-      CS1_Parset *itsCS1PS;
-      const vector<uint> itsSubbandIDs;     ///< IDs of the subband(s)
-      uint  itsNStations;
-      uint  itsNBaselines;
-      uint  itsNChannels;
-      uint  itsNBeams;
-      uint  itsNPolSquared;
-      uint  itsNVisibilities;
-
-      vector <MSWriter *> itsWriters;
-
-      uint itsNrSubbandsPerPset;
-      uint itsNrSubbandsPerStorage;
-
-      vector<uint> itsBandIDs;   ///< MS IDs of the frequency bands
-      uint itsTimeCounter;       ///< Counts the time
-      uint itsTimesToIntegrate;  ///< Number of timeSteps to integrate
-      bool *itsFlagsBuffers;//[NR_SUBBANDS][NR_BASELINES][NR_SUBBAND_CHANNELS][NR_POLARIZATIONS][NR_POLARIZATIONS];
-      float *itsWeightsBuffers;//[NR_SUBBANDS][NR_BASELINES][NR_SUBBAND_CHANNELS];
-      DH_Visibilities::VisibilityType *itsVisibilities;//[NR_SUBBANDS][NR_BASELINES][NR_SUBBAND_CHANNELS][NR_POLARIZATIONS][NR_POLARIZATIONS];
-
-      float itsWeightFactor;
-
-      NSTimer itsWriteTimer;
-
-#ifdef USE_MAC_PI
-      bool itsWriteToMAC;
-      GCF::CEPPMLlight::CEPPropertySet* itsPropertySet;
-      GCF::Common::GCFPValueArray itsVArray; 
-#endif
-    };
-
-  } // namespace CS1
-
-} // namespace LOFAR
-
-#endif
diff --git a/Appl/CEP/CS1/CS1_Storage/src/AHC_Storage.cc b/Appl/CEP/CS1/CS1_Storage/src/AHC_Storage.cc
deleted file mode 100644
index b4ae20006924ffccaef2ad7c8df760a874d1cb51..0000000000000000000000000000000000000000
--- a/Appl/CEP/CS1/CS1_Storage/src/AHC_Storage.cc
+++ /dev/null
@@ -1,113 +0,0 @@
-//#  AHC_Storage.cc: interpretes commands from ACC and executes them on the ApplicationHolder object
-//#
-//#  Copyright (C) 2002-2004
-//#  ASTRON (Netherlands Foundation for Research in Astronomy)
-//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
-//#
-//#  This program is free software; you can redistribute it and/or modify
-//#  it under the terms of the GNU General Public License as published by
-//#  the Free Software Foundation; either version 2 of the License, or
-//#  (at your option) any later version.
-//#
-//#  This program is distributed in the hope that it will be useful,
-//#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//#  GNU General Public License for more details.
-//#
-//#  You should have received a copy of the GNU General Public License
-//#  along with this program; if not, write to the Free Software
-//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-//#
-//#  $Id$
-
-//# Always #include <lofar_config.h> first!
-#include <lofar_config.h>
-#include <Transport/TH_MPI.h>
-
-#include <Common/LofarLogger.h>
-#include <CS1_Storage/AHC_Storage.h>
-
-#include <tinyCEP/Profiler.h>
-#include <PLC/ProcControlServer.h>
-#include <PLC/ProcessControl.h>
-#include <APS/ParameterSet.h>
-#include <CS1_Interface/CS1_Parset.h>
-
-#include <tinyCEP/ApplicationHolderController.h>
-
-// for strncmp
-#include <string.h>
-
-using namespace LOFAR;
-using namespace LOFAR::ACC::APS;
-using namespace LOFAR::ACC::PLC;
-
-using namespace boost::logic;
-
-namespace LOFAR { 
-  namespace CS1 {
-  
-AHC_Storage::AHC_Storage(TinyApplicationHolder& AH, int noRuns)
-  : ApplicationHolderController (AH, noRuns)
-{};
-
-AHC_Storage::~AHC_Storage()
-{};
-
-/* todo: check this code during SAS/MAC tests
-tribool AHC_Storage::pause    (const	string&	)
-{
-  LOG_TRACE_FLOW("Pause called");
-  CS1_Parset itsCS1PS = CS1_Parset(ACC::APS::globalParameterSet());
-  uint nRuns = 1;
-  
-  double startTime = itsCS1PS.startTime();
-  double stopTime = itsCS1PS.stopTime();
-  double stepTime  = itsCS1PS.BGLintegrationTime();
-  uint totalRuns = uint(1 + ceil((stopTime - startTime) / stepTime));
-  
-  totalRuns = ((totalRuns+15)&~15);
-  totalRuns = totalRuns / itsCS1PS.IONintegrationSteps();
-  
-  int nrRunsLeft = totalRuns - nRuns;
-  
-  time_t now = time(0);
-  
-  char buf[26];
-  ctime_r(&now, buf);
-  buf[24] = '\0';
- 
-  cout << "time = " << buf
-#ifdef HAVE_MPI					  
-       << ", rank = "  << TH_MPI::getCurrentRank() 
-#endif					  
-       <<", nrRunsLeft = totalRuns - nRuns = " << totalRuns << " - " << nRuns << " = " << nrRunsLeft << endl;
-  
-  if (totalRuns > nRuns){
-    for (int i=0; i < nrRunsLeft; i++) {
-      if (!ApplicationHolderController::run()) {
-        return (1);
-      }
-    }
-  }
-  
-  
-  return true;
-}
-
-tribool AHC_Storage::quit  	 () 
-{
-  LOG_TRACE_FLOW("Quit called");
-  ApplicationHolderController::quit();
-#if 0
-  pcServer.sendResult(newMsg->getCommand(), ACC::PLC::PcCmdMaskOk);
-						newMsg->setCommand(ACC::PLC::PCCmd(newMsg->getCommand() &~ ACC::PLC::PCCmdResult));
-						quiting = true;
-#endif						
-  LOG_TRACE_FLOW("Quit ready");
-  return true;
-}
-
-*/
-  }
-}  
diff --git a/Appl/CEP/CS1/CS1_Storage/src/AH_Storage.cc b/Appl/CEP/CS1/CS1_Storage/src/AH_Storage.cc
deleted file mode 100644
index e7c7e7f58351bc7c2ec0424cfedb57a85b3a5110..0000000000000000000000000000000000000000
--- a/Appl/CEP/CS1/CS1_Storage/src/AH_Storage.cc
+++ /dev/null
@@ -1,154 +0,0 @@
-//#  AH_Storage.cc: 
-//#
-//#  Copyright (C) 2002-2004
-//#  ASTRON (Netherlands Foundation for Research in Astronomy)
-//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
-//#
-//#  $Id$
-//
-/////////////////////////////////////////////////////////////////////
-
-//# Always #include <lofar_config.h> first!
-#include <lofar_config.h>
-#include <Common/lofar_iostream.h>
-
-#include <APS/ParameterSet.h>
-#include <CS1_Storage/AH_Storage.h>
-#include <Transport/TH_MPI.h>
-#include <CS1_Storage/WH_SubbandWriter.h>
-#include <CEPFrame/Step.h>
-
-#include <Common/LofarLocators.h>
-
-namespace LOFAR
-{
-  namespace CS1
-  {
-
-    AH_Storage::AH_Storage() : 
-      itsCS1PS(0),
-      itsStub (0)
-    {
-    }
-
-
-    AH_Storage::~AH_Storage()
-    {
-      undefine();
-    }
-
-
-    void AH_Storage::define(const LOFAR::KeyValueMap&)
-    {
-      LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,"");
-      
-      ConfigLocator aCL;
-
-      LOG_TRACE_FLOW_STR("Create the top-level composite");
-      Composite comp(0, 0, "topComposite");
-
-      // tell the ApplicationHolder this is the top-level composite
-      setComposite(comp);
-
-      itsCS1PS = new CS1_Parset(&itsParamSet);
-      
-      string configFile(aCL.locate("OLAP.parset"));
-      
-      if (!configFile.empty()) {
-		LOG_DEBUG_STR ("Using OLAP.parset file: " << configFile);
-		itsCS1PS->adoptFile(configFile);
-      }
-      else {
-	LOG_DEBUG_STR ("NO DEFAULT OLAP.PARSET FOUND");
-      }
-	
-      //itsCS1PS->adoptFile(configFile);
-      itsStub = new Stub_BGL(false, true, "BGLProc_Storage", itsCS1PS);
-
-      uint nrSubbands = itsCS1PS->nrSubbands();
-      ASSERT(nrSubbands > 0);
-      uint nrSubbandsPerPset = itsCS1PS->nrSubbandsPerPset();
-      ASSERT(nrSubbandsPerPset > 0);
-      uint nrPsetsPerStorage = itsParamSet.getUint32("OLAP.psetsPerStorage");
-      ASSERT(nrSubbands % nrSubbandsPerPset == 0);
-      ASSERT(nrSubbands / nrSubbandsPerPset % nrPsetsPerStorage == 0);
-
-      // We must derive how many WH_SubbandWriter objects we have to
-      // create. Each WH_SubbandWriter will write up to \a nrSubbandsPerPset
-      // to an AIPS++ Measurement Set.
-      uint nrWriters = nrSubbands / nrSubbandsPerPset / nrPsetsPerStorage;
-      LOG_TRACE_VAR_STR("Creating " << nrWriters << " subband writers ...");
-
-      for (unsigned nw = 0; nw < nrWriters; ++nw)
-      {
-        // For now, we'll assume that the subbands can be sorted and grouped
-        // by ID. Hence, the first WH_SubbandWriter will write the first \a
-        // nrSubbandsPerPset subbands, the second will write the second \a
-        // nrSubbandsPerPset, etc.
-        vector<uint> sbIDs(nrSubbandsPerPset * nrPsetsPerStorage);
-        for (uint i = 0; i < nrSubbandsPerPset * nrPsetsPerStorage; ++i) {
-          sbIDs[i] = nrSubbandsPerPset * nrPsetsPerStorage * nw + i;         
-	  LOG_TRACE_LOOP_STR("Writer " << nw << ": sbIDs[" << i << "] = " 
-                             << sbIDs[i]);
-        }
-
-        char whName[32];
-        snprintf(whName, 32, "WH_Storage_%03d", nw);
-        LOG_TRACE_STAT_STR("Creating " << whName);
-        WH_SubbandWriter wh(whName, sbIDs, itsCS1PS);
-
-        Step step(wh);
-        comp.addBlock(step);
-	
-        // Each writer will run on a separate node.
-        step.runOnNode(nw);
-        // Connect to BG output
-	for (unsigned channel = 0; channel < nrPsetsPerStorage; channel ++) {
-	  step.getInDataManager(channel).setInBuffer(channel, false, 10);
-	  itsStub->connect(nw, channel, step.getInDataManager(channel), channel);
-	}
-      }
-#ifdef HAVE_MPI
-      ASSERTSTR((unsigned) TH_MPI::getNumberOfNodes() == nrWriters,
-                 TH_MPI::getNumberOfNodes() << " == " << nrWriters );
-#endif
-    }
-
-
-    void AH_Storage::undefine()
-    {
-      delete itsCS1PS; itsCS1PS = 0;
-      delete itsStub;  itsStub  = 0;
-    }
-
-
-    void AH_Storage::prerun() 
-    {
-      getComposite().preprocess();
-    }
-    
-
-    void AH_Storage::run(int steps)
-    {
-      LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,"");
-      for (int i = 0; i < steps; i++) {
-        LOG_TRACE_LOOP_STR("processing run " << i );
-        getComposite().process();
-      }
-    }
-
-
-    void AH_Storage::dump() const 
-    {
-      LOG_TRACE_FLOW_STR("AH_Storage::dump() not implemented"  );
-    }
-
-
-    void AH_Storage::quit()
-    {
-    }
-
-
-  } // namespace CS1
-
-} // namespace LOFAR
diff --git a/Appl/CEP/CS1/CS1_Storage/src/CS1_Storage_main.cc b/Appl/CEP/CS1/CS1_Storage/src/CS1_Storage_main.cc
index 3b934ff9011444365c958d77dcc53f401fc83f74..6892e7f5f1411334baecf5ff0f7f2934efa68bda 100644
--- a/Appl/CEP/CS1/CS1_Storage/src/CS1_Storage_main.cc
+++ b/Appl/CEP/CS1/CS1_Storage/src/CS1_Storage_main.cc
@@ -9,25 +9,28 @@
 //# Always #include <lofar_config.h> first!
 #include <lofar_config.h>
 
-// for strncmp
-#include <string.h>
-
 #include <Common/lofar_iostream.h> 
 #include <Common/LofarLogger.h>
 #include <Common/LofarLocators.h>
-
-#include <CS1_Storage/AHC_Storage.h>
-#include <CS1_Storage/AH_Storage.h>
+#include <CS1_Interface/CS1_Parset.h>
+#include <CS1_Storage/SubbandWriter.h>
 #include <CS1_Storage/Package__Version.h>
+#include <PLC/ACCmain.h>
+
+#if defined HAVE_MPI
+#include <mpi.h>
+#endif
+
+#include <boost/lexical_cast.hpp>
+#include <stdexcept>
+
 
 using namespace LOFAR;
 using namespace LOFAR::CS1;
 
-#if 1
-#include <PLC/ACCmain.h>
 
-int main(int argc, char* argv[]) {
-  
+int main(int argc, char *argv[])
+{
   std::string type = "brief";
   Version::show<CS1_StorageVersion> (std::cout, "CS1_Storage", type);  
   
@@ -37,58 +40,48 @@ int main(int argc, char* argv[]) {
   INIT_LOGGER (aCL.locate(logPropFile).c_str());
   LOG_DEBUG_STR("Initialized logsystem with: " << aCL.locate(logPropFile));
 
-  AH_Storage myAH;
-  AHC_Storage myAHC(myAH, 1); // listen to ACC Controller once every 1 runs.
-  return ACC::PLC::ACCmain(argc, argv, &myAHC);
-}
+#if defined HAVE_MPI
+  int rank;
 
+  MPI_Init(&argc, &argv);
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 #else
+  int rank = 0;
+#endif
 
-int main (int argc, const char** argv) {
-  INIT_LOGGER("CS1_Storage");
-
-  // Check invocation syntax
   try {
-    if ((argc==3) && (strncmp("ACC", argv[1], 3) == 0)) {
-      LOG_TRACE_FLOW("Main program started by ACC");
-      // we were called by ACC so execute the ACCmain
-      AH_Storage myAH;
-      ApplicationHolderController myAHController(myAH);
-      myAHController.main(argc, argv);
-    } else {
-      LOG_TRACE_FLOW("Main program not started by ACC");
-      // there are no commandline arguments, so we were not called by ACC
-
-      AH_Storage myAH;
-
-      ACC::APS::ParameterSet ps("CS1.parset");
-      myAH.setParameters(ps);
-
-      myAH.setarg(argc, argv);
-      myAH.baseDefine();
-      cout << "defined" << endl;
-      Profiler::init();
-      myAH.basePrerun();
-      cout << "init done" << endl;
-      Profiler::activate();
-      int nrRuns = ps.getInt32("General.NRuns");
-      cout << "run " << nrRuns << " times" << endl;
-      myAH.baseRun(nrRuns);
-      cout << "run complete" << endl;
-      myAH.baseDump();
-      myAH.baseQuit();
-      Profiler::deActivate();
-    }
-  } catch (Exception& ex) {
-    LOG_FATAL_STR("Caught exception: " << ex << endl);
-    LOG_FATAL_STR(argv[0] << " terminated by exception!");
+    if (argc != 3)
+      throw std::runtime_error(std::string("usage: ") + argv[0] + " parset nr_runs");
+
+    std::clog << "trying to use parset \"" << argv[1] << '"' << std::endl;
+    ACC::APS::ParameterSet parameterSet(argv[1]);
+    CS1_Parset parset(&parameterSet);
+    parset.adoptFile("OLAP.parset");
+
+    SubbandWriter subbandWriter(&parset, rank);
+    subbandWriter.preprocess();
+
+    unsigned nrRuns = boost::lexical_cast<unsigned>(argv[2]);
+    std::clog << "number of runs: " << nrRuns << std::endl;
+
+    for (unsigned i = 0; i < nrRuns; i ++)
+      subbandWriter.process();
+
+    subbandWriter.postprocess();
+  } catch (Exception &ex) {
+    std::cerr << "caught Exception: " << ex.what() << std::endl;
+    exit(1);
+  } catch (std::exception &ex) {
+    std::cerr << "caught std::exception: " << ex.what() << std::endl;
     exit(1);
   } catch (...) {
-    LOG_FATAL_STR("Caught unknown exception, exiting");
-    exit (1);
-  }  
-  LOG_INFO_STR(argv[0] << " terminated normally");
-  return (0);
-}
+    std::cerr << "caught unknown exception" << std::endl;
+    exit(1);
+  }
 
+#if defined HAVE_MPI
+  MPI_Finalize();
 #endif
+
+  return 0;
+}
diff --git a/Appl/CEP/CS1/CS1_Storage/src/MSWriterImpl.cc b/Appl/CEP/CS1/CS1_Storage/src/MSWriterImpl.cc
index 35c09a30f5a8013d95af1033c151fe7ce9f062fc..f1a282982cdb4ae7afefe28d59a4296d53a238f7 100644
--- a/Appl/CEP/CS1/CS1_Storage/src/MSWriterImpl.cc
+++ b/Appl/CEP/CS1/CS1_Storage/src/MSWriterImpl.cc
@@ -26,7 +26,11 @@
 #include <lofar_config.h>
 
 #if defined HAVE_AIPSPP
+
+#include <AMCBase/Epoch.h>
+#include <Common/LofarLogger.h>
 #include <CS1_Storage/MSWriterImpl.h>
+
 #include <ms/MeasurementSets.h>
 #include <tables/Tables/IncrementalStMan.h>
 #include <tables/Tables/StandardStMan.h>
@@ -59,9 +63,11 @@
 #include <casa/Utilities/Assert.h>
 #include <casa/Exceptions/Error.h>
 #include <casa/Arrays/Slicer.h>
-#include <AMCBase/Epoch.h>
-#include <Common/LofarLogger.h>
-#include <Transport/TH_MPI.h>
+
+#if defined HAVE_MPI
+#include <mpi.h>
+#endif
+
 
 namespace LOFAR
 {
@@ -305,7 +311,9 @@ namespace LOFAR
       msspw.addRow();
       msspwCol.numChan().put (rownr, nchannels);
 #if defined HAVE_MPI
-      int nrSubband = TH_MPI::getCurrentRank() + (rownr);
+      int rank;
+      MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+      int nrSubband = rank + rownr; // FIXME: is this correct???
       msspwCol.name().put (rownr, "SB-" + String::toString(nrSubband));
 #else
       msspwCol.name().put (rownr, "SB-0");     
diff --git a/Appl/CEP/CS1/CS1_Storage/src/Makefile.am b/Appl/CEP/CS1/CS1_Storage/src/Makefile.am
index 5c9352df940d8a0000717d91ccdb049e4e727cfb..f47aa1bcb3a03bfcc99edfc6510c98684754661d 100644
--- a/Appl/CEP/CS1/CS1_Storage/src/Makefile.am
+++ b/Appl/CEP/CS1/CS1_Storage/src/Makefile.am
@@ -1,9 +1,8 @@
 lib_LTLIBRARIES			= libcs1_storage.la
 
-libcs1_storage_la_SOURCES	= Package__Version.cc  AH_Storage.cc           \
-				  WH_SubbandWriter.cc     \
-				  AHC_Storage.cc          \
-				  MSWriter.cc             \
+libcs1_storage_la_SOURCES	= Package__Version.cc \
+				  SubbandWriter.cc \
+				  MSWriter.cc \
 				  MSWriterImpl.cc
 
 bin_PROGRAMS			= versioncs1_storage CS1_Storage
@@ -15,7 +14,6 @@ CS1_Storage_DEPENDENCIES	= libcs1_storage.la $(LOFAR_DEPEND)
 configfilesdir			= $(bindir)
 configfiles_DATA                = CS1_Storage.machinefile \
 				  CS1_Storage.log_prop \
-				  typeStruct_TTeraFlopCorrelator.dpl \
 				  PropertyInterface.conf
 
 versioncs1_storage_SOURCES      = versioncs1_storage.cc
diff --git a/Appl/CEP/CS1/CS1_Storage/src/SubbandWriter.cc b/Appl/CEP/CS1/CS1_Storage/src/SubbandWriter.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3a4fbdf2424620e56d191da14b0d7fe1d0bb9ec3
--- /dev/null
+++ b/Appl/CEP/CS1/CS1_Storage/src/SubbandWriter.cc
@@ -0,0 +1,330 @@
+
+
+//#  SubbandWriter.cc: Writes visibilities in an AIPS++ measurement set
+//#
+//#  Copyright (C) 2002-2005
+//#  ASTRON (Netherlands Foundation for Research in Astronomy)
+//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//#  This program is free software; you can redistribute it and/or modify
+//#  it under the terms of the GNU General Public License as published by
+//#  the Free Software Foundation; either version 2 of the License, or
+//#  (at your option) any later version.
+//#
+//#  This program is distributed in the hope that it will be useful,
+//#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//#  GNU General Public License for more details.
+//#
+//#  You should have received a copy of the GNU General Public License
+//#  along with this program; if not, write to the Free Software
+//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//#  $Id$
+
+#include <lofar_config.h>
+
+#include <APS/ParameterSet.h>
+#include <Common/LofarLogger.h>
+#include <Common/lofar_iomanip.h>
+#include <CS1_Storage/SubbandWriter.h>
+#include <CS1_Storage/MSWriter.h>
+#include <Stream/FileStream.h>
+#include <Stream/NullStream.h>
+#include <Stream/SocketStream.h>
+
+#ifdef USE_MAC_PI
+#include <GCF/GCF_PVDouble.h>
+#include <GCF/GCF_PVString.h>
+#endif
+
+#include <boost/lexical_cast.hpp>
+
+#include <time.h>
+
+namespace LOFAR {
+namespace CS1 {
+
+SubbandWriter::SubbandWriter(const CS1_Parset *ps, unsigned rank) 
+:
+  itsCS1PS(ps),
+  itsRank(rank),
+  itsArena(0),
+  itsCorrelatedData(0),
+  itsTimeCounter(0),
+  itsTimesToIntegrate(ps->storageIntegrationSteps()),
+  itsFlagsBuffers(0),
+  itsWeightsBuffers(0),
+  itsVisibilities(0),
+  itsWriteTimer ("writing-MS")
+#ifdef USE_MAC_PI
+,itsPropertySet(0)
+#endif
+{
+#ifdef USE_MAC_PI
+  itsWriteToMAC = itsPS.getBool("Storage.WriteToMAC");
+#endif
+  itsNStations = itsCS1PS->nrStations();
+  itsNBaselines = itsCS1PS->nrBaselines();
+  itsNChannels = itsCS1PS->nrChannelsPerSubband();
+  itsNBeams = itsCS1PS->nrBeams();
+  unsigned pols = itsCS1PS->getUint32("Observation.nrPolarisations");
+  itsNPolSquared = pols*pols;
+
+  // itsWeightFactor = the inverse of maximum number of valid samples
+  itsWeightFactor = 1.0 / (ps->BGLintegrationSteps() * ps->IONintegrationSteps() * ps->storageIntegrationSteps());
+  
+  itsNVisibilities = itsNBaselines * itsNChannels * itsNPolSquared;
+}
+
+
+SubbandWriter::~SubbandWriter() 
+{
+#if defined HAVE_AIPSPP
+  for (unsigned i = 0; i < itsWriters.size(); i ++)
+    delete itsWriters[i];
+
+  itsWriters.clear();
+#endif
+
+#ifdef USE_MAC_PI
+  delete itsPropertySet;
+
+  GCF::Common::GCFPValueArray::iterator it;
+  for (it = itsVArray.begin(); it != itsVArray.end(); it++){
+    delete *it;
+  }
+  itsVArray.clear();
+#endif
+}
+
+
+void SubbandWriter::createInputStreams()
+{
+  string   prefix            = "OLAP.OLAP_Conn.BGLProc_Storage";
+  string   connectionType    = itsCS1PS->getString(prefix + "_Transport");
+
+  itsInputStreams.resize(itsCS1PS->nrPsetsPerStorage());
+
+  for (unsigned i = 0; i < itsCS1PS->nrPsetsPerStorage(); i ++)
+    if (connectionType == "NULL") {
+      std::cout << "input " << i << ": null stream" << std::endl;
+      itsInputStreams[i] = new NullStream;
+    } else if (connectionType == "TCP") {
+      std::string    server = itsCS1PS->getStringVector(prefix + "_ServerHosts")[itsRank];
+      unsigned short port   = boost::lexical_cast<unsigned short>(itsCS1PS->getPortsOf(prefix)[i]);
+
+      std::cout << "input " << i << ": tcp:" << server << ':' << port << std::endl;
+      itsInputStreams[i] = new SocketStream(server.c_str(), port, SocketStream::TCP, SocketStream::Server);
+    } else if (connectionType == "FILE") {
+      std::string filename = itsCS1PS->getString(prefix + "_BaseFileName") + '.' +
+			      boost::lexical_cast<std::string>(itsRank) + '.' +
+			      boost::lexical_cast<std::string>(i);
+
+      std::cout << "input " << i << ": file:" << filename << std::endl;
+      itsInputStreams[i] = new FileStream(filename.c_str());
+    } else {
+      throw std::runtime_error("unsupported ION->Storage stream type");
+    }
+}
+
+
+void SubbandWriter::preprocess() 
+{
+#if defined HAVE_AIPSPP
+  LOG_TRACE_FLOW("SubbandWriter enabling PropertySet");
+#ifdef USE_MAC_PI
+  if (itsWriteToMAC) {
+    itsPropertySet = new GCF::CEPPMLlight::CEPPropertySet("CEP_TFCD", "TTeraFlopCorrelator", GCF::Common::PS_CAT_PERMANENT);
+    itsPropertySet->enable();
+    LOG_TRACE_FLOW("SubbandWriter PropertySet enabled");
+  } else {
+    LOG_TRACE_FLOW("SubbandWriter PropertySet not enabled");
+  };
+#endif
+
+  itsArena	    = new MallocedArena(1 * CorrelatedData::requiredSize(itsNBaselines), 32);
+  itsCorrelatedData = new CorrelatedData(*itsArena, itsNBaselines);
+
+  double startTime = itsCS1PS->startTime();
+  LOG_TRACE_VAR_STR("startTime = " << startTime);
+  
+  vector<double> antPos = itsCS1PS->positions();
+  ASSERTSTR(antPos.size() == 3 * itsNStations,
+	    antPos.size() << " == " << 3 * itsNStations);
+  itsNrSubbandsPerPset	  = itsCS1PS->nrSubbandsPerPset();
+  itsNrSubbandsPerStorage = itsNrSubbandsPerPset * itsCS1PS->nrPsetsPerStorage();
+  LOG_TRACE_VAR_STR("SubbandsPerStorage = " << itsNrSubbandsPerStorage);
+  vector<string> storageStationNames = itsCS1PS->getStringVector("OLAP.storageStationNames");
+
+  itsWriters.resize(itsNrSubbandsPerStorage);
+  
+  vector<unsigned> subbandToBeamMapping = itsCS1PS->subbandToBeamMapping();
+  
+  for (unsigned i = 0; i < itsNrSubbandsPerStorage; i ++) {
+    unsigned currentSubband = itsRank * itsNrSubbandsPerStorage + i;
+
+    itsWriters[i] = new MSWriter(
+      itsCS1PS->getMSname(currentSubband).c_str(),
+      startTime, itsCS1PS->storageIntegrationTime(), itsNChannels,
+      itsNPolSquared, itsNStations, antPos,
+      storageStationNames, itsTimesToIntegrate);
+
+    unsigned       beam    = subbandToBeamMapping[currentSubband];
+    vector<double> beamDir = itsCS1PS->getBeamDirection(beam);
+    itsWriters[i]->addField(beamDir[0], beamDir[1], beam); // FIXME add 1???
+  }
+
+  vector<double> refFreqs = itsCS1PS->subbandToFrequencyMapping();
+
+  // Now we must add \a itsNrSubbandsPerStorage to the measurement set. The
+  // correct indices for the reference frequencies are in the vector of
+  // subbandIDs.      
+  itsBandIDs.resize(itsNrSubbandsPerStorage);
+  double chanWidth = itsCS1PS->channelWidth();
+  LOG_TRACE_VAR_STR("chanWidth = " << chanWidth);
+
+  std::vector<double> frequencies = itsCS1PS->subbandToFrequencyMapping();
+
+  for (unsigned sb = 0; sb < itsNrSubbandsPerStorage; ++ sb) {
+    // compensate for the half-channel shift introduced by the PPF
+    double refFreq = frequencies[itsRank * itsNrSubbandsPerStorage + sb] - chanWidth / 2;
+    itsBandIDs[sb] = itsWriters[sb]->addBand(itsNPolSquared, itsNChannels, refFreq, chanWidth);
+  }
+  
+  // Allocate buffers
+  if (itsTimesToIntegrate > 1) {
+    itsFlagsBuffers   = new bool[itsNrSubbandsPerStorage * itsNVisibilities];
+    itsWeightsBuffers = new float[itsNrSubbandsPerStorage * itsNBaselines * itsNChannels];
+    itsVisibilities   = new fcomplex[itsNrSubbandsPerStorage * itsNVisibilities];
+    clearAllSums();
+  } else {
+    itsFlagsBuffers   = new bool[itsNVisibilities];
+    itsWeightsBuffers = new float[itsNBaselines * itsNChannels];
+  }
+#endif // defined HAVE_AIPSPP
+
+  createInputStreams();
+}
+
+
+void SubbandWriter::clearAllSums()
+{
+  assert(itsTimesToIntegrate > 1);
+  memset(itsWeightsBuffers, 0, itsNrSubbandsPerStorage * itsNBaselines * itsNChannels * sizeof(float));
+  memset(itsVisibilities, 0, itsNrSubbandsPerStorage * itsNVisibilities * sizeof(fcomplex));
+  for (unsigned i = 0; i < itsNrSubbandsPerStorage * itsNVisibilities; i++) {
+    itsFlagsBuffers[i] = true;
+  }
+}
+
+
+void SubbandWriter::process() 
+{
+  static int counter = 0;
+  time_t now = time(0);
+  char buf[26];
+  ctime_r(&now, buf);
+  buf[24] = '\0';
+
+  cout << "time = " << buf <<
+#if defined HAVE_MPI
+	  ", rank = " << itsRank <<
+#endif
+	  ", count = " << counter ++ << endl;
+
+#if defined HAVE_AIPSPP
+  if (itsTimesToIntegrate > 1 && itsTimeCounter % itsTimesToIntegrate == 0) {
+    clearAllSums();
+  }
+#endif
+
+  // Write the visibilities for all subbands per pset.
+  for (unsigned sb = 0; sb < itsNrSubbandsPerStorage; ++ sb) {
+    // find out from which input channel we should read
+    unsigned pset = sb / itsNrSubbandsPerPset;
+
+    itsCorrelatedData->read(itsInputStreams[pset]); // TODO: prefetch in separate thread
+
+    unsigned short *valSamples = itsCorrelatedData->nrValidSamples.origin();
+    fcomplex	   *newVis     = itsCorrelatedData->visibilities.origin();
+   
+    // Write one set of visibilities of size
+    // fcomplex[itsNBaselines][itsNChannels][npol][npol]
+
+#if defined HAVE_AIPSPP
+    if (itsTimesToIntegrate > 1) {
+      for (unsigned i = 0; i < itsNBaselines * itsNChannels; i ++) {
+	itsWeightsBuffers[sb * itsNBaselines * itsNChannels + i] += itsWeightFactor * valSamples[i];
+	bool flagged = valSamples[i] == 0;
+	itsFlagsBuffers[sb * itsNVisibilities + 4 * i    ] &= flagged;
+	itsFlagsBuffers[sb * itsNVisibilities + 4 * i + 1] &= flagged;
+	itsFlagsBuffers[sb * itsNVisibilities + 4 * i + 2] &= flagged;
+	itsFlagsBuffers[sb * itsNVisibilities + 4 * i + 3] &= flagged;
+	// Currently we just add the samples, this way the time centroid stays in place
+	// We could also divide by the weight and multiple the sum by the total weight.
+	itsVisibilities[sb * itsNVisibilities + 4 * i    ] += newVis[4 * i    ];
+	itsVisibilities[sb * itsNVisibilities + 4 * i + 1] += newVis[4 * i + 1];
+	itsVisibilities[sb * itsNVisibilities + 4 * i + 2] += newVis[4 * i + 2];
+	itsVisibilities[sb * itsNVisibilities + 4 * i + 3] += newVis[4 * i + 3];
+      }
+
+      if ((itsTimeCounter + 1) % itsTimesToIntegrate == 0) {
+	itsWriteTimer.start();
+	itsWriters[sb]->write(itsBandIDs[sb],
+	  0, itsNChannels, itsTimeCounter, itsNVisibilities,
+	  &itsVisibilities[sb * itsNVisibilities],
+	  &itsFlagsBuffers[sb * itsNVisibilities], 
+	  &itsWeightsBuffers[sb * itsNBaselines * itsNChannels]);
+	itsWriteTimer.stop();
+      }
+    } else {
+      for (unsigned i = 0; i < itsNBaselines * itsNChannels; i ++) {
+	itsWeightsBuffers[i] = itsWeightFactor * valSamples[i];
+	bool flagged = valSamples[i] == 0;
+	itsFlagsBuffers[4 * i    ] = flagged;
+	itsFlagsBuffers[4 * i + 1] = flagged;
+	itsFlagsBuffers[4 * i + 2] = flagged;
+	itsFlagsBuffers[4 * i + 3] = flagged;
+      }
+
+      itsWriteTimer.start();
+      itsWriters[sb]->write(itsBandIDs[sb],
+	0, itsNChannels, itsTimeCounter, itsNVisibilities,
+	newVis, itsFlagsBuffers, itsWeightsBuffers);
+      itsWriteTimer.stop();
+    }
+#endif
+  }
+
+  // Update the time counter.
+  itsTimeCounter++;
+}
+
+
+void SubbandWriter::postprocess() 
+{
+  for (unsigned i = 0; i < itsInputStreams.size(); i ++)
+    delete itsInputStreams[i];
+
+  itsInputStreams.clear();
+
+  delete [] itsFlagsBuffers;	itsFlagsBuffers   = 0;
+  delete [] itsWeightsBuffers;	itsWeightsBuffers = 0;
+
+#if defined HAVE_AIPSPP
+  for (unsigned i = 0; i < itsWriters.size(); i ++)
+    delete itsWriters[i];
+
+  itsWriters.clear();
+#endif
+
+  delete itsCorrelatedData;	itsCorrelatedData = 0;
+  delete itsArena;		itsArena	  = 0;
+  delete itsVisibilities;	itsVisibilities   = 0;
+
+  cout<<itsWriteTimer<<endl;
+}
+
+} // namespace CS1
+} // namespace LOFAR
diff --git a/Appl/CEP/CS1/CS1_Storage/src/WH_SubbandWriter.cc b/Appl/CEP/CS1/CS1_Storage/src/WH_SubbandWriter.cc
deleted file mode 100644
index 0fb3bdeefee07c1bf22e0dd624e757595797af3d..0000000000000000000000000000000000000000
--- a/Appl/CEP/CS1/CS1_Storage/src/WH_SubbandWriter.cc
+++ /dev/null
@@ -1,317 +0,0 @@
-
-
-//#  WH_SubbandWriter.cc: Writes visibilities in an AIPS++ measurement set
-//#
-//#  Copyright (C) 2002-2005
-//#  ASTRON (Netherlands Foundation for Research in Astronomy)
-//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
-//#
-//#  This program is free software; you can redistribute it and/or modify
-//#  it under the terms of the GNU General Public License as published by
-//#  the Free Software Foundation; either version 2 of the License, or
-//#  (at your option) any later version.
-//#
-//#  This program is distributed in the hope that it will be useful,
-//#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//#  GNU General Public License for more details.
-//#
-//#  You should have received a copy of the GNU General Public License
-//#  along with this program; if not, write to the Free Software
-//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-//#
-//#  $Id$
-
-#include <lofar_config.h>
-
-// General includes
-#include <Common/LofarLogger.h>
-#include <APS/ParameterSet.h>
-#include <Common/lofar_iomanip.h>
-
-// Application specific includes
-#include <CS1_Storage/WH_SubbandWriter.h>
-#include <CS1_Interface/DH_Visibilities.h>
-#include <CS1_Storage/MSWriter.h>
-#include <tinyCEP/Sel_RoundRobin.h>
-#include <Transport/TH_MPI.h>
-
-#ifdef USE_MAC_PI
-#include <GCF/GCF_PVDouble.h>
-#include <GCF/GCF_PVString.h>
-#endif
-
-#include <time.h>
-
-namespace LOFAR
-{
-  namespace CS1
-  {
-
-    WH_SubbandWriter::WH_SubbandWriter(const string& name, 
-                                       const vector<uint>& subbandID,
-				       CS1_Parset *pset) 
-      : WorkHolder(pset->nrPsetsPerStorage(), 0, name, "WH_SubbandWriter"),
-        itsCS1PS(pset),
-        itsSubbandIDs(subbandID),
-        itsTimeCounter(0),
-	itsTimesToIntegrate(pset->storageIntegrationSteps()),
-        itsFlagsBuffers(0),
-        itsWeightsBuffers(0),
-	itsVisibilities(0),
-        itsWriteTimer ("writing-MS")
-#ifdef USE_MAC_PI
-      ,itsPropertySet(0)
-#endif
-    {
-#ifdef USE_MAC_PI
-      itsWriteToMAC = itsPS.getBool("Storage.WriteToMAC");
-#endif
-      itsNStations = itsCS1PS->nrStations();
-      itsNBaselines = itsNStations * (itsNStations +1)/2;
-      itsNChannels = itsCS1PS->nrChannelsPerSubband();
-      itsNBeams = itsCS1PS->nrBeams();
-      uint pols = itsCS1PS->getUint32("Observation.nrPolarisations");
-      itsNPolSquared = pols*pols;
-
-      // itsWeightFactor = the inverse of maximum number of valid samples
-      itsWeightFactor = 1.0 / (pset->BGLintegrationSteps() * pset->IONintegrationSteps() * pset->storageIntegrationSteps());
-      
-      itsNVisibilities = itsNBaselines * itsNChannels * itsNPolSquared;
-
-      char str[32];
-      for (int i=0; i<itsNinputs; i++) {
-        sprintf(str, "DH_in_%d", i);
-        getDataManager().addInDataHolder(i, new DH_Visibilities(str, pset));
-        getDataManager().setAutoTriggerIn(i, false);
-      }
-    }
-
-    WH_SubbandWriter::~WH_SubbandWriter() 
-    {
-#if defined HAVE_AIPSPP
-      for (unsigned i = 0; i < itsWriters.size(); i ++)
-	delete itsWriters[i];
-
-      itsWriters.clear();
-#endif
-
-#ifdef USE_MAC_PI
-      delete itsPropertySet;
-
-      GCF::Common::GCFPValueArray::iterator it;
-      for (it = itsVArray.begin(); it != itsVArray.end(); it++){
-        delete *it;
-      }
-      itsVArray.clear();
-#endif
-    }
-
-    WorkHolder* WH_SubbandWriter::construct(const string& name,
-                                            const vector<uint>& subbandIDs,
-					          CS1_Parset *pset)
-    {
-      return new WH_SubbandWriter(name, subbandIDs, pset);
-    }
-
-    WH_SubbandWriter* WH_SubbandWriter::make(const string& name)
-    {
-      return new WH_SubbandWriter(name, itsSubbandIDs, itsCS1PS);
-    }
-
-    void WH_SubbandWriter::preprocess() 
-    {
-#if defined HAVE_AIPSPP
-      LOG_TRACE_FLOW("WH_SubbandWriter enabling PropertySet");
-#ifdef USE_MAC_PI
-      if (itsWriteToMAC) {
-        itsPropertySet = new GCF::CEPPMLlight::CEPPropertySet("CEP_TFCD", "TTeraFlopCorrelator", GCF::Common::PS_CAT_PERMANENT);
-        itsPropertySet->enable();
-        LOG_TRACE_FLOW("WH_SubbandWriter PropertySet enabled");
-      } else {
-        LOG_TRACE_FLOW("WH_SubbandWriter PropertySet not enabled");
-      };
-#endif
-
-      double startTime = itsCS1PS->startTime();
-      LOG_TRACE_VAR_STR("startTime = " << startTime);
-      
-      vector<double> antPos = itsCS1PS->positions();
-      ASSERTSTR(antPos.size() == 3 * itsNStations,
-                antPos.size() << " == " << 3 * itsNStations);
-      itsNrSubbandsPerPset	= itsCS1PS->nrSubbandsPerPset();
-      itsNrSubbandsPerStorage	= itsNrSubbandsPerPset * itsCS1PS->nrPsetsPerStorage();
-      LOG_TRACE_VAR_STR("SubbandsPerStorage = " << itsNrSubbandsPerStorage);
-      vector<string> storageStationNames = itsCS1PS->getStringVector("OLAP.storageStationNames");
-
-      unsigned mssesPerStorage = itsCS1PS->getUint32("OLAP.subbandsPerPset") * itsCS1PS->getUint32("OLAP.psetsPerStorage");
-      itsWriters.resize(mssesPerStorage);
-      
-#if 0
-      vector<int32>  bl2beams = itsCS1PS->beamlet2beams();
-      vector<uint32> sb2Index = itsCS1PS->subband2Index();
-#else
-      vector<unsigned> subbandToBeamMapping = itsCS1PS->subbandToBeamMapping();
-#endif
-      
-      for (unsigned i = 0; i < mssesPerStorage; i ++) {
-#if defined HAVE_MPI
-	unsigned currentSubband = (TH_MPI::getCurrentRank() * mssesPerStorage + i);
-#else
-	unsigned currentSubband = i;
-#endif
-	itsWriters[i] = new MSWriter(
-	  itsCS1PS->getMSname(currentSubband).c_str(),
-	  startTime, itsCS1PS->storageIntegrationTime(), itsNChannels,
-	  itsNPolSquared, itsNStations, antPos,
-	  storageStationNames, itsTimesToIntegrate);
-
-#if 0
-        vector<double> beamDir = itsCS1PS->getBeamDirection(bl2beams[sb2Index[currentSubband]]);
-	itsWriters[i]->addField(beamDir[0], beamDir[1], bl2beams[sb2Index[currentSubband]]);
-#else
-	unsigned       beam    = subbandToBeamMapping[currentSubband];
-        vector<double> beamDir = itsCS1PS->getBeamDirection(beam);
-	itsWriters[i]->addField(beamDir[0], beamDir[1], beam); // FIXME add 1???
-#endif
-      }
-
-      vector<double> refFreqs = itsCS1PS->subbandToFrequencyMapping();
-
-      // Now we must add \a itsNrSubbandsPerStorage to the measurement set. The
-      // correct indices for the reference frequencies are in the vector of
-      // subbandIDs.      
-      itsBandIDs.resize(itsNrSubbandsPerStorage);
-      double chanWidth = itsCS1PS->channelWidth();
-      LOG_TRACE_VAR_STR("chanWidth = " << chanWidth);
-
-      for (uint sb = 0; sb < itsNrSubbandsPerStorage; ++sb) {
-	// compensate for the half-channel shift introduced by the PPF
-	double refFreq = refFreqs[itsSubbandIDs[sb]] - chanWidth / 2;
-	itsBandIDs[sb] = itsWriters[sb]->addBand(itsNPolSquared, itsNChannels, refFreq, chanWidth);
-      }
-      
-      // Allocate buffers
-      if (itsTimesToIntegrate > 1) {
-	itsFlagsBuffers   = new bool[itsNrSubbandsPerStorage * itsNVisibilities];
-	itsWeightsBuffers = new float[itsNrSubbandsPerStorage * itsNBaselines * itsNChannels];
-	itsVisibilities   = new DH_Visibilities::VisibilityType[itsNrSubbandsPerStorage * itsNVisibilities];
-	clearAllSums();
-      } else {
-	itsFlagsBuffers   = new bool[itsNVisibilities];
-	itsWeightsBuffers = new float[itsNBaselines * itsNChannels];
-      }
-#endif // defined HAVE_AIPSPP
-    }
-
-    void WH_SubbandWriter::clearAllSums()
-    {
-      assert(itsTimesToIntegrate > 1);
-      memset(itsWeightsBuffers, 0, itsNrSubbandsPerStorage * itsNBaselines * itsNChannels * sizeof(float));
-      memset(itsVisibilities, 0, itsNrSubbandsPerStorage * itsNVisibilities * sizeof(DH_Visibilities::VisibilityType));
-      for (uint i = 0; i < itsNrSubbandsPerStorage * itsNVisibilities; i++) {
-	itsFlagsBuffers[i] = true;
-      }
-    }
-
-    void WH_SubbandWriter::process() 
-    {
-      static int counter = 0;
-      time_t now = time(0);
-      char buf[26];
-      ctime_r(&now, buf);
-      buf[24] = '\0';
-
-      cout << "time = " << buf <<
-#if defined HAVE_MPI
-	      ", rank = " << TH_MPI::getCurrentRank() <<
-#endif
-	      ", count = " << counter ++ << endl;
-
-#if defined HAVE_AIPSPP
-      if (itsTimesToIntegrate > 1 && itsTimeCounter % itsTimesToIntegrate == 0) {
-	clearAllSums();
-      }
-#endif
-
-      // Write the visibilities for all subbands per pset.
-      for (uint sb = 0; sb < itsNrSubbandsPerStorage; ++ sb) {
-        // find out from which input channel we should read
-	unsigned pset = sb / itsNrSubbandsPerPset;
-
-	DH_Visibilities			    *inputDH	= static_cast<DH_Visibilities *>(getDataManager().getInHolder(pset));
-        DH_Visibilities::NrValidSamplesType *valSamples = &inputDH->getNrValidSamples(0, 0);
-  	DH_Visibilities::VisibilityType     *newVis	= &inputDH->getVisibility(0, 0, 0, 0);
-       
-        // Write 1 DH_Visibilities of size
-        // fcomplex[itsNBaselines][itsNChannels][npol][npol]
-
-#if defined HAVE_AIPSPP
-	if (itsTimesToIntegrate > 1) {
-	  for (uint i = 0; i < itsNBaselines * itsNChannels; i ++) {
-	    itsWeightsBuffers[sb * itsNBaselines * itsNChannels + i] += itsWeightFactor * valSamples[i];
-	    bool flagged = valSamples[i] == 0;
-	    itsFlagsBuffers[sb * itsNVisibilities + 4 * i    ] &= flagged;
-	    itsFlagsBuffers[sb * itsNVisibilities + 4 * i + 1] &= flagged;
-	    itsFlagsBuffers[sb * itsNVisibilities + 4 * i + 2] &= flagged;
-	    itsFlagsBuffers[sb * itsNVisibilities + 4 * i + 3] &= flagged;
-	    // Currently we just add the samples, this way the time centroid stays in place
-	    // We could also divide by the weight and multiple the sum by the total weight.
-	    itsVisibilities[sb * itsNVisibilities + 4 * i    ] += newVis[4 * i    ];
-	    itsVisibilities[sb * itsNVisibilities + 4 * i + 1] += newVis[4 * i + 1];
-	    itsVisibilities[sb * itsNVisibilities + 4 * i + 2] += newVis[4 * i + 2];
-	    itsVisibilities[sb * itsNVisibilities + 4 * i + 3] += newVis[4 * i + 3];
-	  }
-
-	  if ((itsTimeCounter + 1) % itsTimesToIntegrate == 0) {
-	    itsWriteTimer.start();
-	    itsWriters[sb]->write(itsBandIDs[sb],
-	      0, itsNChannels, itsTimeCounter, itsNVisibilities,
-	      &itsVisibilities[sb * itsNVisibilities],
-	      &itsFlagsBuffers[sb * itsNVisibilities], 
-	      &itsWeightsBuffers[sb * itsNBaselines * itsNChannels]);
-	    itsWriteTimer.stop();
-	  }
-	} else {
-	  for (uint i = 0; i < itsNBaselines * itsNChannels; i ++) {
-	    itsWeightsBuffers[i] = itsWeightFactor * valSamples[i];
-	    bool flagged = valSamples[i] == 0;
-	    itsFlagsBuffers[4 * i    ] = flagged;
-	    itsFlagsBuffers[4 * i + 1] = flagged;
-	    itsFlagsBuffers[4 * i + 2] = flagged;
-	    itsFlagsBuffers[4 * i + 3] = flagged;
-	  }
-
-	  itsWriteTimer.start();
-	  itsWriters[sb]->write(itsBandIDs[sb],
-	    0, itsNChannels, itsTimeCounter, itsNVisibilities,
-	    newVis, itsFlagsBuffers, itsWeightsBuffers);
-	  itsWriteTimer.stop();
-	}
-#endif
-
-	getDataManager().readyWithInHolder(pset);
-      }
-
-      // Update the time counter.
-      itsTimeCounter++;
-    }
-
-
-    void WH_SubbandWriter::postprocess() 
-    {
-      delete [] itsFlagsBuffers;	itsFlagsBuffers   = 0;
-      delete [] itsWeightsBuffers;	itsWeightsBuffers = 0;
-
-#if defined HAVE_AIPSPP
-      for (unsigned i = 0; i < itsWriters.size(); i ++)
-	delete itsWriters[i];
-
-      itsWriters.clear();
-#endif
-      cout<<itsWriteTimer<<endl;
-    }
-    
-  } // namespace CS1
-
-} // namespace LOFAR