diff --git a/Appl/CEP/CS1/CS1_FrequencyFlagger/src/FlaggerProcessControl.cc b/Appl/CEP/CS1/CS1_FrequencyFlagger/src/FlaggerProcessControl.cc
index d6370114b35cd48adef9a28f47a3c4b383249b9b..233d87ef3816d1cb3e44a9613950792585ba8df2 100644
--- a/Appl/CEP/CS1/CS1_FrequencyFlagger/src/FlaggerProcessControl.cc
+++ b/Appl/CEP/CS1/CS1_FrequencyFlagger/src/FlaggerProcessControl.cc
@@ -28,7 +28,9 @@
 #include "MS_File.h"
 #include "FrequencyFlagger.h"
 
-#define FLAGGER_VERSION "0.10"
+#define FLAGGER_VERSION "0.20"
+// 0.10 initial version
+// 0.20 added more algorithms
 
 namespace LOFAR
 {
@@ -88,18 +90,8 @@ namespace LOFAR
 
       cout  << string(FLAGGER_VERSION) + string(" autoflagging by Adriaan Renting for LOFAR CS1 data\n") +
               string("This is experimental software, please report errors or requests to renting@astron.nl\n") +
-              string("Documentation can be found at: www.astron.nl/~renting\n");
+              string("Documentation can be found at: www.lofar.org/operations/doku.php?id=engineering:software:postprocessing_software\n");
       cout << itsMS << endl;
-      if (itsMS == "")
-      {
-        cerr  << "Usage: WSRT_flagger ms=test.MS crosspol=false window=13 min=5 max=5.5 flagrms=true flagdata=true existing=true" << endl
-              << "Where ms       [no default]    is the Measurementset" << endl
-              << "      existing [default true]  determines if existing flags are kept (no new flag cat. is created)" << endl << endl
-              << "Data at point window/2 will be flagged on:" << endl
-              << "      vis[window/2] - (median(Re(vis[])) + median(Im(vis[]))) " << endl
-              << "    > (min + (max-min)*baselinelength/maxbaselinelength)*sigma" << endl;
-        return false;
-      }
       myMS       = new MS_File(itsMS);
       itsFlagger = new FrequencyFlagger (myMS, itsThreshold);
       }
diff --git a/Appl/CEP/CS1/CS1_FrequencyFlagger/src/FrequencyFlagger.cc b/Appl/CEP/CS1/CS1_FrequencyFlagger/src/FrequencyFlagger.cc
index 1423093d8fe9197baf952d88407f9afaaccb9b48..908b70f329dfb8ce4e37c1b279f78de8965e5f3d 100644
--- a/Appl/CEP/CS1/CS1_FrequencyFlagger/src/FrequencyFlagger.cc
+++ b/Appl/CEP/CS1/CS1_FrequencyFlagger/src/FrequencyFlagger.cc
@@ -215,44 +215,41 @@ namespace LOFAR
       vector<int>    RMSCounter(NumPolarizations, 0);
       bool           FlagCompleteRow = true;
       int            flagcount       = 0;
-      for (int i = NumChannels-1; i >= 0; i--) //calculata RMS of unflagged datapoints
+      for (int j = NumPolarizations-1; j >= 0; j--)
       {
-        for (int j = NumPolarizations-1; j >= 0; j--)
+        for (int i = NumChannels-1; i >= 0; i--) //calculata RMS of unflagged datapoints
         {
           if (!ExistingFlags || !Flags(j, i))
-          {
-            MS[j] += pow(abs(Timeslots(j, i)), 2);
-            RMSCounter[j] += 1;
+          { double temp = pow(abs(Timeslots(j, i)), 2);
+            if (!isNaN(temp))
+            {
+              MS[j] += temp;
+              RMSCounter[j] += 1;
+            }
           }
         }
-      }
-      for (int j = NumPolarizations-1; j >= 0; j--)
-      {
         if (RMSCounter[j])
         { RMS[j] = sqrt(MS[j] /RMSCounter[j]);
-        }
-      }
-      for (int i = NumChannels-1; i >= 0; i--)
-      {
-        bool FlagAllPolarizations = false;
-        for (int j = NumPolarizations-1; j >= 0; j--)
-        { //we need to loop twice, once to determine FlagAllCorrelations
-          if (!FlagAllPolarizations || !Flags(j, i))
+          for (int i = NumChannels-1; i >= 0; i--)
           {
-            FlagAllPolarizations |= RMS[j] * FlagThreshold < abs(Timeslots(j, i));
+            if (!ExistingFlags || !Flags(j, i))
+            { double temp = abs(Timeslots(j, i));
+              bool flag   = isNaN(temp) || RMS[j] * FlagThreshold < temp;
+              //cout << RMS[j] << " " << (RMS[j] * FlagThreshold) << " " << temp << " " << (flag) << endl;
+              if (flag)
+              { flagcount++;
+              }
+              else
+              { FlagCompleteRow = false;
+              }
+              Flags(j, i) = flag || (ExistingFlags && Flags(j, i));
+            }
           }
         }
-        for (int j = NumPolarizations-1; j >= 0; j--)
-        { //the second loop we set the flags
-          if (FlagAllPolarizations)
-          { Flags(j, i) = true;
-            flagcount++;
-          }
-          else
-          {
-            FlagCompleteRow = false;
-            Flags(j, i)     = false; //this can set an existing flag to false if ExistingFlags == False, othewise RMS[j] == 0
-          }
+        else
+        {
+          flagcount += NumChannels;
+          Flags.row(j) = true;
         }
       }
       //these need to be separated out into a different function for clarity