diff --git a/RTCP/CNProc/src/CN_Processing.cc b/RTCP/CNProc/src/CN_Processing.cc
index 2b7e1383ef7676fec7215f6f4db63d31ae06b0d9..b0429673a4b8b1f998926d230a6176b0598ed7c5 100644
--- a/RTCP/CNProc/src/CN_Processing.cc
+++ b/RTCP/CNProc/src/CN_Processing.cc
@@ -241,9 +241,11 @@ template <typename SAMPLE_TYPE> CN_Processing<SAMPLE_TYPE>::CN_Processing(const
       if (LOG_CONDITION)
         LOG_DEBUG_STR("Considering dedispersion for " << itsTotalNrPencilBeams << " pencil beams");
 
-      itsDMs.resize(itsTotalNrPencilBeams, 0.0);
+      itsCoherentDMs.resize(itsTotalNrPencilBeams, 0.0);
+      itsIncoherentDMs.resize(itsTotalNrPencilBeams, 0.0);
 
-      bool anyNonzeroDM = false;
+      bool dedisperseCoherent = false;
+      bool dedisperseIncoherent = false;
       unsigned i = 0;
       unsigned nrSAPs = parset.nrBeams();
 
@@ -252,18 +254,32 @@ template <typename SAMPLE_TYPE> CN_Processing<SAMPLE_TYPE>::CN_Processing(const
           double DM = parset.dispersionMeasure(sap, pencil);
           if(LOG_CONDITION) LOG_DEBUG_STR("DM for beam " << sap << " pencil " << pencil << " is " << DM);
 
-          if (DM != 0.0)
-            anyNonzeroDM = true;
+          if (DM != 0.0) {
+            if (parset.isCoherent(sap, pencil)) {
+              dedisperseCoherent = true;
+              itsCoherentDMs[i] = DM;
+            } else {
+              dedisperseIncoherent = true;
+              itsIncoherentDMs[i] = DM;
+            }
+          }
 
-          itsDMs[i++] = DM;
+          i++;
         }
       }
 
-      if (anyNonzeroDM) {
-        if(LOG_CONDITION) LOG_DEBUG("Doing dedispersion after beam forming");
-        itsDedispersionAfterBeamForming = new DedispersionAfterBeamForming(parset, itsBeamFormedData, itsCurrentSubband->list(), itsDMs);
+      if (dedisperseCoherent) {
+        if(LOG_CONDITION) LOG_DEBUG("Doing dedispersion for coherent data");
+        itsDedispersionAfterBeamForming = new DedispersionAfterBeamForming(parset, itsBeamFormedData, itsCurrentSubband->list(), itsCoherentDMs);
+      } else {
+        if(LOG_CONDITION) LOG_DEBUG("NOT doing dedispersion for coherent data");
+      }
+
+      if (dedisperseIncoherent) {
+        if(LOG_CONDITION) LOG_DEBUG("Doing dedispersion for incoherent data");
+        itsDedispersionBeforeBeamForming = new DedispersionBeforeBeamForming(parset, itsFilteredData, itsCurrentSubband->list(), itsIncoherentDMs);
       } else {
-        if(LOG_CONDITION) LOG_DEBUG("NOT doing dedispersion after beam forming, because all DMs are 0");
+        if(LOG_CONDITION) LOG_DEBUG("NOT doing dedispersion for incoherent data");
       }
 
       // Our assembly code (BeamFormerAsm) requires groups of beams it processes to
@@ -292,8 +308,10 @@ template <typename SAMPLE_TYPE> CN_Processing<SAMPLE_TYPE>::CN_Processing(const
       itsPreTransposeBeamFormedData.resize(itsMaxNrPencilBeams);
   }
 
-  if (itsHasPhaseTwo || itsHasPhaseThree)
-    itsStokes = new Stokes(itsNrChannels, itsNrSamplesPerIntegration);
+  if (itsHasPhaseTwo || itsHasPhaseThree) {
+    itsCoherentStokes   = new CoherentStokes(itsNrChannels, itsNrSamplesPerIntegration);
+    itsIncoherentStokes = new IncoherentStokes(itsNrChannels, itsNrSamplesPerIntegration, nrMergedStations, parset.nrChannelsPerSubband() / parset.incoherentStokesChannelsPerSubband(), itsDedispersionBeforeBeamForming, itsBigAllocator);
+  }
 
 #if defined HAVE_MPI
   if (itsHasPhaseOne || itsHasPhaseTwo)
@@ -565,19 +583,19 @@ template <typename SAMPLE_TYPE> int CN_Processing<SAMPLE_TYPE>::transposeBeams(u
 
         if (info.coherent) {
           if (itsDedispersionAfterBeamForming != 0)
-            dedisperseAfterBeamForming(i, itsDMs[beam]);
+            dedisperseAfterBeamForming(i, itsCoherentDMs[beam]);
 
           switch (info.stokesType) {
             case STOKES_I:
               if(LOG_CONDITION)
                 LOG_DEBUG_STR(itsLogPrefix << "Calculating coherent Stokes I");
-              itsStokes->calculateCoherent<false>(itsBeamFormedData.get(), itsPreTransposeBeamFormedData[beam].get(), i, info);
+              itsCoherentStokes->calculate<false>(itsBeamFormedData.get(), itsPreTransposeBeamFormedData[beam].get(), i, info);
               break;
 
             case STOKES_IQUV:
               if(LOG_CONDITION)
                 LOG_DEBUG_STR(itsLogPrefix << "Calculating coherent Stokes IQUV");
-              itsStokes->calculateCoherent<true>(itsBeamFormedData.get(), itsPreTransposeBeamFormedData[beam].get(), i, info);
+              itsCoherentStokes->calculate<true>(itsBeamFormedData.get(), itsPreTransposeBeamFormedData[beam].get(), i, info);
               break;
 
             case STOKES_XXYY:
@@ -591,17 +609,19 @@ template <typename SAMPLE_TYPE> int CN_Processing<SAMPLE_TYPE>::transposeBeams(u
               break;
           }
         } else {  
+          // TODO: optimise dedispersion to only do the forwardFFT once
+
           switch (info.stokesType) {
             case STOKES_I:
               if(LOG_CONDITION)
                 LOG_DEBUG_STR(itsLogPrefix << "Calculating incoherent Stokes I");
-              itsStokes->calculateIncoherent<false>(itsFilteredData.get(), itsPreTransposeBeamFormedData[beam].get(), itsBeamFormer->getStationMapping(), info);
+              itsIncoherentStokes->calculate<false>(itsFilteredData.get(), itsPreTransposeBeamFormedData[beam].get(), itsBeamFormer->getStationMapping(), info, subband, itsIncoherentDMs[beam]);
               break;
 
             case STOKES_IQUV:
               if(LOG_CONDITION)
                 LOG_DEBUG_STR(itsLogPrefix << "Calculating incoherent Stokes IQUV");
-              itsStokes->calculateIncoherent<true>(itsFilteredData.get(), itsPreTransposeBeamFormedData[beam].get(), itsBeamFormer->getStationMapping(), info);
+              itsIncoherentStokes->calculate<true>(itsFilteredData.get(), itsPreTransposeBeamFormedData[beam].get(), itsBeamFormer->getStationMapping(), info, subband, itsIncoherentDMs[beam]);
               break;
 
             case STOKES_XXYY:
@@ -680,14 +700,14 @@ template <typename SAMPLE_TYPE> void CN_Processing<SAMPLE_TYPE>::dedisperseAfter
 {
 #if defined HAVE_MPI
   if (LOG_CONDITION)
-    LOG_DEBUG_STR(itsLogPrefix << "Start dedispersion at " << MPI_Wtime());
+    LOG_DEBUG_STR(itsLogPrefix << "Start dedispersion of coherent data at " << MPI_Wtime());
 #endif
 
-  static NSTimer timer("dedispersion (after BF) timer", true, true);
+  static NSTimer timer("dedispersion (coherent) timer", true, true);
 
   computeTimer.start();
   timer.start();
-  itsDedispersionAfterBeamForming->dedisperse(itsBeamFormedData, *itsCurrentSubband, beam, dm);
+  itsDedispersionAfterBeamForming->dedisperse(itsBeamFormedData.get(), *itsCurrentSubband, beam, dm);
   timer.stop();
   computeTimer.stop();
 }
diff --git a/RTCP/CNProc/src/CN_Processing.h b/RTCP/CNProc/src/CN_Processing.h
index bd94585a547f67e1fa8be39bf973d2fd895345ea..f7a0e6ad16b2c824c866562c9ddeb9908199cd7e 100644
--- a/RTCP/CNProc/src/CN_Processing.h
+++ b/RTCP/CNProc/src/CN_Processing.h
@@ -134,7 +134,8 @@ template <typename SAMPLE_TYPE> class CN_Processing : public CN_Processing_Base
     const CN_Transpose2 &itsTranspose2Logic;
     std::vector<double> itsCenterFrequencies;
     SmartPtr<Ring>	itsFirstInputSubband, itsCurrentSubband;
-    std::vector<double> itsDMs;
+    std::vector<double> itsCoherentDMs;
+    std::vector<double> itsIncoherentDMs;
     bool		itsFakeInputData;
     bool		itsHasPhaseOne, itsHasPhaseTwo, itsHasPhaseThree;
 
@@ -169,9 +170,11 @@ template <typename SAMPLE_TYPE> class CN_Processing : public CN_Processing_Base
 
     SmartPtr<PPF<SAMPLE_TYPE> >			itsPPF;
     SmartPtr<BeamFormer>			itsBeamFormer;
-    SmartPtr<Stokes>				itsStokes;
+    SmartPtr<CoherentStokes>			itsCoherentStokes;
+    SmartPtr<IncoherentStokes>			itsIncoherentStokes;
     SmartPtr<Correlator>			itsCorrelator;
     SmartPtr<DedispersionAfterBeamForming>	itsDedispersionAfterBeamForming;
+    SmartPtr<DedispersionBeforeBeamForming>	itsDedispersionBeforeBeamForming;
     SmartPtr<PreCorrelationFlagger>		itsPreCorrelationFlagger;
     SmartPtr<PostCorrelationFlagger>		itsPostCorrelationFlagger;
     SmartPtr<Trigger>				itsTrigger;
diff --git a/RTCP/CNProc/src/Dedispersion.cc b/RTCP/CNProc/src/Dedispersion.cc
index 17b4727f2e320f5673f3ae001a5f4ffde4599cae..d89bfc43262b1b1acc61e43cd2a1740c35d4ac16 100644
--- a/RTCP/CNProc/src/Dedispersion.cc
+++ b/RTCP/CNProc/src/Dedispersion.cc
@@ -115,7 +115,7 @@ void Dedispersion::initFFT(fcomplex *data)
 }
 
 
-void Dedispersion::forwardFFT(fcomplex *data)
+void Dedispersion::forwardFFT(const fcomplex *data)
 {
 #if defined HAVE_FFTW3
   fftwf_execute_dft(itsFFTWforwardPlan, (fftwf_complex *) data, (fftwf_complex *) &itsFFTedBuffer[0][0]);
@@ -195,20 +195,18 @@ void Dedispersion::applyChirp(unsigned subbandIndex, unsigned dmIndex, unsigned
 }
 
 
-void DedispersionBeforeBeamForming::dedisperse(FilteredData *filteredData, unsigned subbandIndex, double dm)
+void DedispersionBeforeBeamForming::dedisperse(const FilteredData *inData, FilteredData *outData, unsigned instat, unsigned outstat, unsigned firstch, unsigned numch, unsigned subbandIndex, double dm)
 {
   if (dm == 0.0)
     return;
 
   unsigned dmIndex = itsDMindices[dm];
 
-  for (unsigned channel = 0; channel < itsNrChannels; channel ++) {
-    for (unsigned station = 0; station < itsNrStations; station ++) {
-      for (unsigned block = 0; block < itsNrSamplesPerIntegration; block += itsFFTsize) {
-	forwardFFT(&filteredData->samples[channel][station][block][0]);
-	applyChirp(subbandIndex, dmIndex, channel);
-	backwardFFT(&filteredData->samples[channel][station][block][0]);
-      }
+  for (unsigned channel = 0; channel < numch; channel ++) {
+    for (unsigned block = 0; block < itsNrSamplesPerIntegration; block += itsFFTsize) {
+      forwardFFT(&inData->samples[firstch + channel][instat][block][0]);
+      applyChirp(subbandIndex, dmIndex, channel);
+      backwardFFT(&outData->samples[channel][outstat][block][0]);
     }
   }
 }
diff --git a/RTCP/CNProc/src/Dedispersion.h b/RTCP/CNProc/src/Dedispersion.h
index 63fa76faf3a6315f61afe88505467597f84a4848..979a705faad2ceb8a892ce6d8579f63bf99820fe 100644
--- a/RTCP/CNProc/src/Dedispersion.h
+++ b/RTCP/CNProc/src/Dedispersion.h
@@ -37,7 +37,7 @@ class Dedispersion
 
   protected:
     void initFFT(fcomplex *data);
-    void forwardFFT(fcomplex *data);
+    void forwardFFT(const fcomplex *data);
     void backwardFFT(fcomplex *data);
 
     const unsigned itsNrChannels, itsNrSamplesPerIntegration, itsFFTsize;
@@ -66,7 +66,7 @@ class DedispersionBeforeBeamForming : public Dedispersion
   public:
     DedispersionBeforeBeamForming(const Parset &, FilteredData *, const std::vector<unsigned> &subbandIndices, std::vector<double> &DMs, Allocator &allocator = heapAllocator);
 
-    void dedisperse(FilteredData *, unsigned subbandIndex, double dm);
+    void dedisperse(const FilteredData *, FilteredData *, unsigned instat, unsigned outstat, unsigned firstch, unsigned numch, unsigned subbandIndex, double dm);
 
   private:
     const unsigned itsNrStations;
diff --git a/RTCP/CNProc/src/Stokes.cc b/RTCP/CNProc/src/Stokes.cc
index 86e7f1503af0ca7cc9f104c01b092a04448aa87b..76729bc58eb2770d782c857bbe150cbb6ebc6562 100644
--- a/RTCP/CNProc/src/Stokes.cc
+++ b/RTCP/CNProc/src/Stokes.cc
@@ -52,10 +52,25 @@ Stokes::Stokes(unsigned nrChannels, unsigned nrSamples)
   itsNrChannels(nrChannels),
   itsNrSamples(nrSamples)
 {
-} 
+}
+CoherentStokes::CoherentStokes(unsigned nrChannels, unsigned nrSamples)
+:
+  Stokes(nrChannels, nrSamples)
+{
+}
+
+IncoherentStokes::IncoherentStokes(unsigned nrChannels, unsigned nrSamples, unsigned nrStations, unsigned maxChannelIntegrations, DedispersionBeforeBeamForming *dedispersion, Allocator &allocator)
+:
+  Stokes(nrChannels, nrSamples),
+  itsAllocator(allocator),
+  itsDedispersedData(dedispersion ? new FilteredData(nrStations, maxChannelIntegrations, itsNrSamples, allocator) : 0),
+  itsDedispersion(dedispersion),
+  itsMaxChannelIntegrations(maxChannelIntegrations)
+{
+}
 
 // Calculate coherent stokes values from pencil beams.
-template <bool ALLSTOKES> void Stokes::calculateCoherent(const BeamFormedData *sampleData, PreTransposeBeamFormedData *stokesData, unsigned inbeam, const StreamInfo &info)
+template <bool ALLSTOKES> void CoherentStokes::calculate(const SampleData<> *sampleData, PreTransposeBeamFormedData *stokesData, unsigned inbeam, const StreamInfo &info)
 {
   // TODO: divide by #valid stations
   ASSERT(sampleData->samples.shape()[0] > inbeam);
@@ -75,7 +90,6 @@ template <bool ALLSTOKES> void Stokes::calculateCoherent(const BeamFormedData *s
   // process flags
   const std::vector<SparseSet<unsigned> > &inflags = sampleData->flags;
   std::vector<SparseSet<unsigned> > &outflags = stokesData->flags;
-
   outflags[0] = inflags[inbeam];
   outflags[0] /= timeIntegrations;
 
@@ -164,8 +178,8 @@ template <bool ALLSTOKES> void Stokes::calculateCoherent(const BeamFormedData *s
   }  
 }
 
-template void Stokes::calculateCoherent<true>(const BeamFormedData *, PreTransposeBeamFormedData *, unsigned, const StreamInfo&);
-template void Stokes::calculateCoherent<false>(const BeamFormedData *, PreTransposeBeamFormedData *, unsigned, const StreamInfo&);
+template void CoherentStokes::calculate<true>(const SampleData<> *, PreTransposeBeamFormedData *, unsigned, const StreamInfo&);
+template void CoherentStokes::calculate<false>(const SampleData<> *, PreTransposeBeamFormedData *, unsigned, const StreamInfo&);
 
 template <bool ALLSTOKES> struct stokes {
   // the sums of stokes values over a number of stations or beams
@@ -215,42 +229,39 @@ template <bool ALLSTOKES> static inline void addStokes(struct stokes<ALLSTOKES>
 }
 
 // Calculate incoherent stokes values from (filtered) station data.
-template <bool ALLSTOKES> void Stokes::calculateIncoherent(const FilteredData *sampleData, PreTransposeBeamFormedData *stokesData, const std::vector<unsigned> &stationMapping, const StreamInfo &info)
+template <bool ALLSTOKES> void IncoherentStokes::calculate(const FilteredData *in, PreTransposeBeamFormedData *out, const std::vector<unsigned> &stationMapping, const StreamInfo &info, unsigned subband, double dm)
 {
   const unsigned nrStations = stationMapping.size();
 
-  ASSERT(sampleData->samples.shape()[0] == itsNrChannels);
-  // sampleData->samples.shape()[1] has to be bigger than all elements in stationMapping
-  ASSERT(sampleData->samples.shape()[2] >= itsNrSamples);
-  ASSERT(sampleData->samples.shape()[3] == NR_POLARIZATIONS);
+  ASSERT(in->samples.shape()[0] == itsNrChannels);
+  // in->samples.shape()[1] has to be bigger than all elements in stationMapping
+  ASSERT(in->samples.shape()[2] >= itsNrSamples);
+  ASSERT(in->samples.shape()[3] == NR_POLARIZATIONS);
 
   const unsigned &timeIntegrations = info.timeIntFactor;
-  const unsigned upperBound = static_cast<unsigned>(itsNrSamples * Stokes::MAX_FLAGGED_PERCENTAGE);
   const unsigned channelIntegrations = itsNrChannels / info.nrChannels;
-  bool validStation[nrStations];
-  unsigned nrValidStations = 0;
-  const MultiDimArray<fcomplex, 4> &in = sampleData->samples;
-  const std::vector< SparseSet<unsigned> > &inflags = sampleData->flags;
-  PreTransposeBeamFormedData *out = stokesData;
   std::vector<unsigned> stationList;
 
+  ASSERT(channelIntegrations <= itsMaxChannelIntegrations);
+
   out->flags[0].reset();
 
   for (unsigned stat = 0; stat < nrStations; stat ++) {
+    const unsigned upperBound = static_cast<unsigned>(itsNrSamples * Stokes::MAX_FLAGGED_PERCENTAGE);
     const unsigned srcStat = stationMapping[stat];
 
-    if(inflags[srcStat].count() > upperBound) {
+    if(in->flags[srcStat].count() > upperBound) {
       // drop station due to too much flagging
-      validStation[stat] = false;
     } else {
-      validStation[stat] = true;
-      nrValidStations ++;
+      stationList.push_back(srcStat);  
 
       // conservative flagging: flag anything that is flagged in one of the stations
-      out->flags[0] |= inflags[srcStat];
+      out->flags[0] |= in->flags[srcStat];
     }
   }
 
+  const unsigned nrValidStations = stationList.size();
+
   if (nrValidStations == 0) {
     /* if no valid samples, insert zeroes */
 
@@ -264,28 +275,36 @@ template <bool ALLSTOKES> void Stokes::calculateIncoherent(const FilteredData *s
     return;
   }
 
-  // enumerate all valid stations
-  for (unsigned stat = 0; stat < nrStations; stat ++) {
-    unsigned srcStat = stationMapping[stat];
-
-    if (!validStation[stat])
-      continue;
-
-    stationList.push_back(srcStat);  
-  }
-
   // shorten the flags over the integration length
   out->flags[0] /= timeIntegrations;
 
+  const bool dedisperse = dm != 0.0 && itsDedispersion;
+  
   for (unsigned inch = 0, outch = 0; inch < itsNrChannels; inch += channelIntegrations, outch++) {
+
+    if (dedisperse) {
+      // dedisperse channelIntegration channels for all stations
+      for (unsigned outstat = 0; outstat < stationList.size(); outstat ++) {
+        unsigned instat = stationList[outstat];
+
+        itsDedispersion->dedisperse( in, itsDedispersedData.get(), instat, outstat, inch, channelIntegrations, subband, dm );
+      }
+    }
+
     for (unsigned inTime = 0, outTime = 0; inTime < itsNrSamples; inTime += timeIntegrations, outTime ++) {
       struct stokes<ALLSTOKES> stokes;
 
-      for (unsigned i = 0; i < stationList.size(); i ++) {
-        unsigned stat = stationList[i];
+      if (dedisperse) {
+         for (unsigned i = 0; i < nrValidStations; i ++)
+          for (unsigned c = 0; c < channelIntegrations; c++)
+            addStokes<ALLSTOKES>(stokes, reinterpret_cast<const fcomplex (*)[2]>(&itsDedispersedData->samples[c][i][inTime][0]), timeIntegrations);
+      } else {
+         for (unsigned i = 0; i < nrValidStations; i ++) {
+          unsigned stat = stationList[i];
 
-        for (unsigned c = 0; c < channelIntegrations; c++)
-          addStokes<ALLSTOKES>(stokes, reinterpret_cast<const fcomplex (*)[2]>(&in[inch + c][stat][inTime][0]), timeIntegrations);
+          for (unsigned c = 0; c < channelIntegrations; c++)
+            addStokes<ALLSTOKES>(stokes, reinterpret_cast<const fcomplex (*)[2]>(&in->samples[inch + c][stat][inTime][0]), timeIntegrations);
+        }  
       }  
 
       #define dest(stokes) out->samples[stokes][outch][outTime]
@@ -301,8 +320,8 @@ template <bool ALLSTOKES> void Stokes::calculateIncoherent(const FilteredData *s
   }
 }
 
-template void Stokes::calculateIncoherent<true>(const FilteredData *, PreTransposeBeamFormedData *, const std::vector<unsigned> &, const StreamInfo&);
-template void Stokes::calculateIncoherent<false>(const FilteredData *, PreTransposeBeamFormedData *, const std::vector<unsigned> &, const StreamInfo&);
+template void IncoherentStokes::calculate<true>(const FilteredData *, PreTransposeBeamFormedData *, const std::vector<unsigned> &, const StreamInfo&, unsigned, double);
+template void IncoherentStokes::calculate<false>(const FilteredData *, PreTransposeBeamFormedData *, const std::vector<unsigned> &, const StreamInfo&, unsigned, double);
 
 } // namespace RTCP
 } // namespace LOFAR
diff --git a/RTCP/CNProc/src/Stokes.h b/RTCP/CNProc/src/Stokes.h
index 442dbdac76c0d5b2e94ec302ada630438163b60a..b2102edce224e4dda1acbda06c0b651f80c6b0dd 100644
--- a/RTCP/CNProc/src/Stokes.h
+++ b/RTCP/CNProc/src/Stokes.h
@@ -6,6 +6,7 @@
 #include <Interface/BeamFormedData.h>
 #include <Interface/MultiDimArray.h>
 #include <Interface/Parset.h>
+#include <Dedispersion.h>
 
 #if 0 || !defined HAVE_BGP
 #define STOKES_C_IMPLEMENTATION
@@ -22,14 +23,33 @@ class Stokes
 
     Stokes(unsigned nrChannels, unsigned nrSamples);
 
-    template <bool ALLSTOKES> void calculateCoherent(const BeamFormedData *sampleData, PreTransposeBeamFormedData *stokesData, unsigned inbeam, const StreamInfo &info);
-    template <bool ALLSTOKES> void calculateIncoherent(const FilteredData *sampleData, PreTransposeBeamFormedData *stokesData, const std::vector<unsigned> &stationMapping, const StreamInfo &info);
-
-  private:
+  protected:
     const unsigned          itsNrChannels;
     const unsigned          itsNrSamples;
 };
 
+class CoherentStokes: public Stokes
+{
+  public:
+    CoherentStokes(unsigned nrChannels, unsigned nrSamples);
+
+    template <bool ALLSTOKES> void calculate(const SampleData<> *sampleData, PreTransposeBeamFormedData *stokesData, unsigned inbeam, const StreamInfo &info);
+};
+
+class IncoherentStokes: public Stokes
+{
+  public:
+    IncoherentStokes(unsigned nrChannels, unsigned nrSamples, unsigned nrStations, unsigned channelIntegrations, DedispersionBeforeBeamForming *dedispersion, Allocator &allocator);
+
+    template <bool ALLSTOKES> void calculate(const FilteredData *sampleData, PreTransposeBeamFormedData *stokesData, const std::vector<unsigned> &stationMapping, const StreamInfo &info, unsigned subband, double dm);
+
+  private:  
+    Allocator                     &itsAllocator;
+    SmartPtr<FilteredData>        itsDedispersedData;
+    DedispersionBeforeBeamForming *itsDedispersion;
+    const unsigned                itsMaxChannelIntegrations;
+};
+
 } // namespace RTCP
 } // namespace LOFAR
 
diff --git a/RTCP/CNProc/test/tStokes.cc b/RTCP/CNProc/test/tStokes.cc
index 2dd7cfca64d136dd86abd696912f8c6e4d41c844..9042f4abedd7458d56eb1e9bc5e4aafa5980784c 100644
--- a/RTCP/CNProc/test/tStokes.cc
+++ b/RTCP/CNProc/test/tStokes.cc
@@ -67,7 +67,7 @@ void test_incoherent_stokes( unsigned NRSTOKES, unsigned INTEGRATION ) {
   }
 
   // calculate
-  Stokes s( NRCHANNELS, NRSAMPLES );
+  IncoherentStokes s( NRCHANNELS, NRSAMPLES, NRSTATIONS, 1, 0, heapAllocator );
 
   struct StreamInfo info;
 
@@ -84,9 +84,9 @@ void test_incoherent_stokes( unsigned NRSTOKES, unsigned INTEGRATION ) {
   info.part = 0;
 
   if (NRSTOKES == 4) {
-    s.calculateIncoherent<true>( &in, &out, stationMapping, info );
+    s.calculate<true>( &in, &out, stationMapping, info, 0, 0.0 );
   } else {
-    s.calculateIncoherent<false>( &in, &out, stationMapping, info );
+    s.calculate<false>( &in, &out, stationMapping, info, 0, 0.0 );
   }
 
   // check
@@ -161,7 +161,7 @@ void test_coherent_stokes( unsigned NRSTOKES, unsigned INTEGRATION, unsigned CHA
     }
   }  
 
-  Stokes s( NRCHANNELS, NRSAMPLES );
+  CoherentStokes s( NRCHANNELS, NRSAMPLES );
 
   for( unsigned b = 0; b < NRPENCILBEAMS; b++ ) {
     struct StreamInfo info;
@@ -191,9 +191,9 @@ void test_coherent_stokes( unsigned NRSTOKES, unsigned INTEGRATION, unsigned CHA
 
     // calculate using Stokes.cc
     if (NRSTOKES == 4) {
-      s.calculateCoherent<true>( &in, &out, b, info );
+      s.calculate<true>( &in, &out, b, info );
     } else {
-      s.calculateCoherent<false>( &in, &out, b, info );
+      s.calculate<false>( &in, &out, b, info );
     }
 
     // calculate our own