diff --git a/.gitattributes b/.gitattributes
index fc32bfda7390f2ea638e1bb27afc1151f9a4d6cb..28e47f313d51010b75e09949340f67e0a1c7e942 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -5143,6 +5143,7 @@ SAS/XML_generator/test/test_regression.in_data/txt/old_input.txt -text
 SAS/XML_generator/test/test_regression.in_data/txt/old_pulsar_pipe_test.txt -text
 SAS/XML_generator/test/test_regression.in_data/txt/test_LB.txt -text
 SAS/XML_generator/test/test_regression.in_data/txt/test_input.txt -text
+SAS/XML_generator/test/test_regression.in_data/txt/test_input_cep4.txt -text
 SAS/XML_generator/test/test_regression.in_data/txt/test_input_long_baseline_pipeline.txt -text
 SAS/XML_generator/test/test_regression.in_data/xml/20150713_4C17.31.xml -text
 SAS/XML_generator/test/test_regression.in_data/xml/20150731_G46_run1_HBA.xml -text
@@ -5161,6 +5162,7 @@ SAS/XML_generator/test/test_regression.in_data/xml/lc4_019_1.xml -text
 SAS/XML_generator/test/test_regression.in_data/xml/pulsar_pipe_test.xml -text
 SAS/XML_generator/test/test_regression.in_data/xml/test_LB.xml -text
 SAS/XML_generator/test/test_regression.in_data/xml/test_input.xml -text
+SAS/XML_generator/test/test_regression.in_data/xml/test_input_cep4.xml -text
 SAS/XML_generator/test/test_regression.in_data/xml/test_input_long_baseline_pipeline.xml -text
 SAS/XML_generator/test/test_regression.py -text
 SAS/XML_generator/test/test_regression.sh -text
diff --git a/SAS/XML_generator/test/test_regression.in_data/txt/test_input_cep4.txt b/SAS/XML_generator/test/test_regression.in_data/txt/test_input_cep4.txt
new file mode 100644
index 0000000000000000000000000000000000000000..14c4ed71de96de54af8637d8a3fda63e59139237
--- /dev/null
+++ b/SAS/XML_generator/test/test_regression.in_data/txt/test_input_cep4.txt
@@ -0,0 +1,87 @@
+projectName=test_lofar                  # be careful! Don't make typos here. Or otherwise a non-valid project will be created in mom
+mainFolderName=                         # the name of the folder that will contain all blocks, if left unspecified no main folder will be created
+mainFolderDescription=
+
+BLOCK
+
+cluster=CEP4
+split_targets = T                       # true:create a separate target observation for every target (beam) line or false:combine them in a multi-beam observation
+calibration = none                      # internal / external / none
+create_calibrator_observations = T      # create calibration observations before target observations? (ignored if calibration = none)
+create_target_cal_beam = T              # create a calibration beam in the target observation(s)? (ignored if calibration = none)
+processing=Pulsar                       # can be one of Calibration, Preprocessing, Imaging, Pulsar, LongBaseline, none
+imagingPipeline=none                    # can be one of MSSS, standard, none
+repeat=2                                # the number of repeats of this block
+
+packageName=alwin1          # the name that will be given to the package folder that contains this block's observation and pipelines
+packageDescription=example template
+packageTag=                             # optional tag that will be prepended before every observation and pipeline name/description (Max 8 characters).
+
+antennaMode=HBA Dual
+clock=200 MHz
+instrumentFilter=110-190 MHz
+numberOfBitsPerSample=8
+integrationTime=1.0
+channelsPerSubband=16
+stationList=nl                          # comma-separated list of station names and/or the following aliasses: core, superterp, remote, international, all, nl
+tbbPiggybackAllowed=T
+aartfaacPiggybackAllowed=F
+###### Which data types should be produced: ######
+correlatedData=T
+coherentStokesData=F
+incoherentStokesData=T
+flysEye=F
+coherentDedisperseChannels=False
+###### Coherent Stokes parameters ######
+subbandsPerFileCS=512
+numberCollapsedChannelsCS=16
+stokesDownsamplingStepsCS=128
+whichCS=IQUV
+###### Incoherent Stokes parameters ######
+#subbandsPerFileIS=16
+#numberCollapsedChannelsIS=4
+#stokesDownsamplingStepsIS=12
+#whichIS=IQUV
+flaggingStrategy=HBAdefault             # flagging strategy used for AOflagger
+calibratorDuration_s=120                # duration of calibration observations in seconds
+targetDuration_s=600                    # duration of target observations in seconds
+
+###### Globals are used when a target/calibration line does not have its own specific parameter specified for that property ######
+#Global_TAB=
+#c;05:34:51.94;+22:00:52.2              # a coherent tab with absolute coordinates 05:34:51.94, +22:00:52.2
+#Global_TABrings=1;0.1                   # nr of tabrings and tabring size
+#Global_Pulsar=B0329+54;T;T;DSPSR EXTRA OPTIONS;PREPDATA;5.1;-2;F;F;F;F;F;2BF2FITS;4;101;RFI FIND EXTRA OPTIONS;PREPFOLD EXTRA;PREPSUBBAND Extra; 0.6;T;T
+Global_Demix=64;10;64;10;CasA,CygA;
+
+Global_Subbands=104..334, 341, 349, 364, 372, 380, 388, 396, 404, 413, 421, 430, 438, 447;244
+
+
+# startTimeUTC, the start time of the first observation. format: yyyy-MM-dd hh:mm:ss
+# un-comment the startTimeUTC to have the observation start times generated
+startTimeUTC=2014-07-07 12:00:00
+# timeStep's in seconds
+timeStep1=60
+timeStep2=60
+
+calibratorBeam=
+19:59:28.35;+40:44:02.0;3C295;;;;;T;60
+BBS=3C295;;;T
+#Demix=
+TAB:
+c;05:34:51.94;+22:00:52.2
+
+# target beams and target pipelines
+# ra ;dec; targetname; subbandList; nrSubbands; nrTABrings; TABringSize; create_pipeline [;pipeline duration seconds]
+# optionally followed by BBS and/or demixing settings
+# BBS: SkyModel;BBS_baselines;BBS_correlations;BBS_beamModelEnable;BBS_solveParms;BBS_solveUVRange;BBS_strategyBaselines;BBS_strategyTimeRange
+# Demix: avg freq step; avg time step; demix freq step; demix time step; demix_always; demix_if_needed; ignore_target
+# Pulsar: pulsar; single-pulse; raw-to-8bit; dspsr-extra-opts; prepdata-extra-opts; 8bit-conversion-sigma; tsubint; norfi; nofold; nopdmp; skip-dspsr; rrats; 2bf2fits-extra-opts; decode-sigma; decode-nblocks; rfifind-extra-opts; prepfold-extra-opts; prepsubband-extra-opts; dynamic-spectrum-time-average; skip-dynamic-spectrum; skip-prepfold
+
+targetBeams=
+05:34:51.94;+22:00:52.2;Crab test;54..297;244;;;T;600
+#Demix=16;1;16;1
+#Pulsar=B0531+21;;T;;;;;;;;;;;;;;;;;;
+#0.0417300951946;0.00558069028325;Sun;54..297;244;;;T;8100
+#Demix=16;1;16;1
+
+BLOCK
diff --git a/SAS/XML_generator/test/test_regression.in_data/xml/test_input_cep4.xml b/SAS/XML_generator/test/test_regression.in_data/xml/test_input_cep4.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6166597a7fc72697831eca7248bdcf70f3635602
--- /dev/null
+++ b/SAS/XML_generator/test/test_regression.in_data/xml/test_input_cep4.xml
@@ -0,0 +1,369 @@
+<?xml version="1.0" encoding="UTF-8"?>
+  <lofar:project xmlns:lofar="http://www.astron.nl/MoM2-Lofar" xmlns:mom2="http://www.astron.nl/MoM2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.astron.nl/MoM2-Lofar http://lofar.astron.nl:8080/mom3/schemas/LofarMoM2.xsd http://www.astron.nl/MoM2 http://lofar.astron.nl:8080/mom3/schemas/MoM2.xsd ">
+  <version>2.15.0</version>
+  <template version="2.15.0" author="Alwin de Jong,Adriaan Renting" changedBy="Adriaan Renting">
+  <description>XML Template generator version 2.15.0</description>
+  </template>
+  <name>test_lofar</name>
+  <children>
+   <item index="0">
+        <lofar:folder topology_parent="true">
+          <topology>0</topology>
+          <name>alwin1</name>
+          <description>example template (Pulsar)</description>
+          <children>
+          <item index="0">
+                <lofar:observation>
+                  <name>Crab test/1/TO</name>
+                  <description>Crab test/1/TO (Target Observation)</description>
+                  <topology>B0.1.T.0</topology>
+                  <predecessor_topology></predecessor_topology>
+                  <currentStatus>
+                    <mom2:openedStatus/>
+                  </currentStatus>
+                  <lofar:observationAttributes>
+                    <observationId>
+                    </observationId>
+                    <name>Crab test/1/TO</name>
+                    <projectName>test_lofar</projectName>
+                    <instrument>Beam Observation</instrument>
+                    <defaultTemplate>BeamObservation</defaultTemplate>
+                    <tbbPiggybackAllowed>true</tbbPiggybackAllowed>
+                    <aartfaacPiggybackAllowed>false</aartfaacPiggybackAllowed>
+                    <userSpecification>
+                      <correlatedData>true</correlatedData>
+                      <coherentStokesData>false</coherentStokesData>
+                      <incoherentStokesData>true</incoherentStokesData>
+                      <antenna>HBA Dual</antenna>
+                      <clock mode="200 MHz"/>
+                      <instrumentFilter>110-190 MHz</instrumentFilter>
+                      <integrationInterval>1.0</integrationInterval>
+                      <channelsPerSubband>16</channelsPerSubband>
+                      <coherentDedisperseChannels>false</coherentDedisperseChannels>
+                      <tiedArrayBeams>
+                        <flyseye>false</flyseye>
+                      </tiedArrayBeams>
+                      <stokes>
+                        <integrateChannels>false</integrateChannels>
+                        <subbandsPerFileCS>512</subbandsPerFileCS>
+                        <numberCollapsedChannelsCS>16</numberCollapsedChannelsCS>
+                        <stokesDownsamplingStepsCS>128</stokesDownsamplingStepsCS>
+                        <whichCS>IQUV</whichCS>
+                        <subbandsPerFileIS></subbandsPerFileIS>
+                        <numberCollapsedChannelsIS></numberCollapsedChannelsIS>
+                        <stokesDownsamplingStepsIS></stokesDownsamplingStepsIS>
+                        <whichIS></whichIS>
+                      </stokes>
+                      <stationSet>Custom</stationSet>
+                      <stations>CS001,CS002,CS003,CS004,CS005,CS006,CS007,CS011,CS013,CS017,CS021,CS024,CS026,CS028,CS030,CS031,CS032,CS101,CS103,CS201,CS301,CS302,CS401,CS501,RS106,RS205,RS208,RS210,RS305,RS306,RS307,RS310,RS406,RS407,RS409,RS503,RS508,RS509</stations>
+                      <timeFrame>UT</timeFrame>
+                      <startTime>2014-07-07T12:00:00</startTime>
+                      <endTime>2014-07-07T12:10:00</endTime>
+                      <duration>600</duration>
+                      <bypassPff>false</bypassPff>
+                      <enableSuperterp>false</enableSuperterp>
+                      <numberOfBitsPerSample>8</numberOfBitsPerSample>
+                    </userSpecification>
+                  </lofar:observationAttributes>
+                  <children>
+<item index="0">
+                      <lofar:measurement xsi:type="lofar:BFMeasurementType">
+                        <name>Crab test</name>
+                        <description>Crab test</description>
+                        <topology>B0.1.T.SAP000</topology>
+                        <currentStatus>
+                          <mom2:openedStatus/>
+                        </currentStatus>
+                        <lofar:bfMeasurementAttributes>
+                          <measurementType>Target</measurementType>
+                          <specification>
+                            <targetName>Crab test</targetName>
+                            <ra>83.7164166667</ra>
+                            <dec>22.0145</dec>
+                            <equinox>J2000</equinox>
+                            <duration>0</duration>
+                            <subbandsSpecification>
+                              <subbands>54..297</subbands>
+                            </subbandsSpecification>
+                          <tiedArrayBeams>
+                            <flyseye>false</flyseye>
+                          <nrTabRings>0</nrTabRings>
+                          <tabRingSize></tabRingSize>
+                            <tiedArrayBeamList>
+                              
+                            </tiedArrayBeamList>
+                          </tiedArrayBeams>
+                          </specification>
+                        </lofar:bfMeasurementAttributes>
+                        <resultDataProducts>
+                                          <item>
+                    <lofar:uvDataProduct>
+                    <name>B0.1.T.SAP000.uv.dps</name>
+                    <topology>B0.1.T.SAP000.uv.dps</topology>
+                    <status>no_data</status>
+                    <storageCluster>
+                      <name>CEP4</name>
+                      <partition>/data</partition>
+                    </storageCluster>
+                    </lofar:uvDataProduct>
+                  </item>
+                                  <item>
+                    <lofar:bfDataProduct>
+                    <name>B0.1.T.SAP000.is</name>
+                    <topology>B0.1.T.SAP000.is</topology>
+                    <status>no_data</status>
+                    <storageCluster>
+                      <name>CEP4</name>
+                      <partition>/data</partition>
+                    </storageCluster>
+                    </lofar:bfDataProduct>
+                  </item>
+                        </resultDataProducts>   
+                      </lofar:measurement>
+                    </item>
+</children>
+                </lofar:observation>
+                </item>
+        <item index="0">
+              <lofar:pipeline xsi:type="lofar:PulsarPipelineType">
+                <topology>B0.1.PT0</topology>
+                <predecessor_topology>B0.1.T</predecessor_topology>
+                <name>Crab test/1.0/PP</name>
+                <description>Crab test/1.0/PP (Pulsar Pipeline)</description>
+                <pipelineAttributes>
+                  <defaultTemplate>Pulsar Pipeline</defaultTemplate>
+                  <duration>600</duration>
+                  <_2bf2fitsExtraOpts></_2bf2fitsExtraOpts>
+                  <_8bitConversionSigma></_8bitConversionSigma>
+                  <decodeNblocks></decodeNblocks>
+                  <decodeSigma></decodeSigma>
+                  <digifilExtraOpts></digifilExtraOpts>
+                  <dspsrExtraOpts></dspsrExtraOpts>
+                  <dynamicSpectrumTimeAverage></dynamicSpectrumTimeAverage>
+                  <nofold></nofold>
+                  <nopdmp></nopdmp>
+                  <norfi></norfi>
+                  <prepdataExtraOpts></prepdataExtraOpts>
+                  <prepfoldExtraOpts></prepfoldExtraOpts>
+                  <prepsubbandExtraOpts></prepsubbandExtraOpts>
+                  <pulsar></pulsar>
+                  <rawTo8bit></rawTo8bit>
+                  <rfifindExtraOpts></rfifindExtraOpts>
+                  <rrats></rrats>
+                  <singlePulse></singlePulse>
+                  <skipDsps></skipDsps>
+                  <skipDynamicSpectrum></skipDynamicSpectrum>
+                  <skipPrepfold></skipPrepfold>
+                  <tsubint></tsubint>
+                    <processingCluster>
+                    <name>CEP4</name>
+                    <partition>/data</partition>
+                    <numberOfTasks>244</numberOfTasks>
+                    <minRAMPerTask unit="byte">1000000000</minRAMPerTask>
+                    <minScratchPerTask unit="byte">100000000</minScratchPerTask>    
+                    <maxDurationPerTask>PT600S</maxDurationPerTask>
+                    <numberOfCoresPerTask>20</numberOfCoresPerTask>
+                    <runSimultaneous>true</runSimultaneous>
+                  </processingCluster>
+                </pipelineAttributes>
+                <usedDataProducts>
+                  <item>
+                    <lofar:bfDataProduct topology="B0.1.T.SAP000.is">
+                    </lofar:bfDataProduct>
+                  </item>
+                </usedDataProducts>
+                <resultDataProducts>
+                  <item>
+                    <lofar:pulsarDataProduct>
+                      <name>B0.1.PT0.pu.dps</name>
+                      <topology>B0.1.PT0.pu.dps</topology>
+                      <status>no_data</status>
+                      <storageCluster>
+                      <name>CEP4</name>
+                      <partition>/data</partition>
+                    </storageCluster>
+                    </lofar:pulsarDataProduct>
+                  </item>
+                </resultDataProducts>
+              </lofar:pipeline>
+            </item>
+          <item index="0">
+                <lofar:observation>
+                  <name>Crab test/2/TO</name>
+                  <description>Crab test/2/TO (Target Observation)</description>
+                  <topology>B0.2.T.0</topology>
+                  <predecessor_topology></predecessor_topology>
+                  <currentStatus>
+                    <mom2:openedStatus/>
+                  </currentStatus>
+                  <lofar:observationAttributes>
+                    <observationId>
+                    </observationId>
+                    <name>Crab test/2/TO</name>
+                    <projectName>test_lofar</projectName>
+                    <instrument>Beam Observation</instrument>
+                    <defaultTemplate>BeamObservation</defaultTemplate>
+                    <tbbPiggybackAllowed>true</tbbPiggybackAllowed>
+                    <aartfaacPiggybackAllowed>false</aartfaacPiggybackAllowed>
+                    <userSpecification>
+                      <correlatedData>true</correlatedData>
+                      <coherentStokesData>false</coherentStokesData>
+                      <incoherentStokesData>true</incoherentStokesData>
+                      <antenna>HBA Dual</antenna>
+                      <clock mode="200 MHz"/>
+                      <instrumentFilter>110-190 MHz</instrumentFilter>
+                      <integrationInterval>1.0</integrationInterval>
+                      <channelsPerSubband>16</channelsPerSubband>
+                      <coherentDedisperseChannels>false</coherentDedisperseChannels>
+                      <tiedArrayBeams>
+                        <flyseye>false</flyseye>
+                      </tiedArrayBeams>
+                      <stokes>
+                        <integrateChannels>false</integrateChannels>
+                        <subbandsPerFileCS>512</subbandsPerFileCS>
+                        <numberCollapsedChannelsCS>16</numberCollapsedChannelsCS>
+                        <stokesDownsamplingStepsCS>128</stokesDownsamplingStepsCS>
+                        <whichCS>IQUV</whichCS>
+                        <subbandsPerFileIS></subbandsPerFileIS>
+                        <numberCollapsedChannelsIS></numberCollapsedChannelsIS>
+                        <stokesDownsamplingStepsIS></stokesDownsamplingStepsIS>
+                        <whichIS></whichIS>
+                      </stokes>
+                      <stationSet>Custom</stationSet>
+                      <stations>CS001,CS002,CS003,CS004,CS005,CS006,CS007,CS011,CS013,CS017,CS021,CS024,CS026,CS028,CS030,CS031,CS032,CS101,CS103,CS201,CS301,CS302,CS401,CS501,RS106,RS205,RS208,RS210,RS305,RS306,RS307,RS310,RS406,RS407,RS409,RS503,RS508,RS509</stations>
+                      <timeFrame>UT</timeFrame>
+                      <startTime>2014-07-07T12:11:00</startTime>
+                      <endTime>2014-07-07T12:21:00</endTime>
+                      <duration>600</duration>
+                      <bypassPff>false</bypassPff>
+                      <enableSuperterp>false</enableSuperterp>
+                      <numberOfBitsPerSample>8</numberOfBitsPerSample>
+                    </userSpecification>
+                  </lofar:observationAttributes>
+                  <children>
+<item index="0">
+                      <lofar:measurement xsi:type="lofar:BFMeasurementType">
+                        <name>Crab test</name>
+                        <description>Crab test</description>
+                        <topology>B0.2.T.SAP000</topology>
+                        <currentStatus>
+                          <mom2:openedStatus/>
+                        </currentStatus>
+                        <lofar:bfMeasurementAttributes>
+                          <measurementType>Target</measurementType>
+                          <specification>
+                            <targetName>Crab test</targetName>
+                            <ra>83.7164166667</ra>
+                            <dec>22.0145</dec>
+                            <equinox>J2000</equinox>
+                            <duration>0</duration>
+                            <subbandsSpecification>
+                              <subbands>54..297</subbands>
+                            </subbandsSpecification>
+                          <tiedArrayBeams>
+                            <flyseye>false</flyseye>
+                          <nrTabRings>0</nrTabRings>
+                          <tabRingSize></tabRingSize>
+                            <tiedArrayBeamList>
+                              
+                            </tiedArrayBeamList>
+                          </tiedArrayBeams>
+                          </specification>
+                        </lofar:bfMeasurementAttributes>
+                        <resultDataProducts>
+                                          <item>
+                    <lofar:uvDataProduct>
+                    <name>B0.2.T.SAP000.uv.dps</name>
+                    <topology>B0.2.T.SAP000.uv.dps</topology>
+                    <status>no_data</status>
+                    <storageCluster>
+                      <name>CEP4</name>
+                      <partition>/data</partition>
+                    </storageCluster>
+                    </lofar:uvDataProduct>
+                  </item>
+                                  <item>
+                    <lofar:bfDataProduct>
+                    <name>B0.2.T.SAP000.is</name>
+                    <topology>B0.2.T.SAP000.is</topology>
+                    <status>no_data</status>
+                    <storageCluster>
+                      <name>CEP4</name>
+                      <partition>/data</partition>
+                    </storageCluster>
+                    </lofar:bfDataProduct>
+                  </item>
+                        </resultDataProducts>   
+                      </lofar:measurement>
+                    </item>
+</children>
+                </lofar:observation>
+                </item>
+        <item index="0">
+              <lofar:pipeline xsi:type="lofar:PulsarPipelineType">
+                <topology>B0.2.PT0</topology>
+                <predecessor_topology>B0.2.T</predecessor_topology>
+                <name>Crab test/2.0/PP</name>
+                <description>Crab test/2.0/PP (Pulsar Pipeline)</description>
+                <pipelineAttributes>
+                  <defaultTemplate>Pulsar Pipeline</defaultTemplate>
+                  <duration>600</duration>
+                  <_2bf2fitsExtraOpts></_2bf2fitsExtraOpts>
+                  <_8bitConversionSigma></_8bitConversionSigma>
+                  <decodeNblocks></decodeNblocks>
+                  <decodeSigma></decodeSigma>
+                  <digifilExtraOpts></digifilExtraOpts>
+                  <dspsrExtraOpts></dspsrExtraOpts>
+                  <dynamicSpectrumTimeAverage></dynamicSpectrumTimeAverage>
+                  <nofold></nofold>
+                  <nopdmp></nopdmp>
+                  <norfi></norfi>
+                  <prepdataExtraOpts></prepdataExtraOpts>
+                  <prepfoldExtraOpts></prepfoldExtraOpts>
+                  <prepsubbandExtraOpts></prepsubbandExtraOpts>
+                  <pulsar></pulsar>
+                  <rawTo8bit></rawTo8bit>
+                  <rfifindExtraOpts></rfifindExtraOpts>
+                  <rrats></rrats>
+                  <singlePulse></singlePulse>
+                  <skipDsps></skipDsps>
+                  <skipDynamicSpectrum></skipDynamicSpectrum>
+                  <skipPrepfold></skipPrepfold>
+                  <tsubint></tsubint>
+                    <processingCluster>
+                    <name>CEP4</name>
+                    <partition>/data</partition>
+                    <numberOfTasks>244</numberOfTasks>
+                    <minRAMPerTask unit="byte">1000000000</minRAMPerTask>
+                    <minScratchPerTask unit="byte">100000000</minScratchPerTask>    
+                    <maxDurationPerTask>PT600S</maxDurationPerTask>
+                    <numberOfCoresPerTask>20</numberOfCoresPerTask>
+                    <runSimultaneous>true</runSimultaneous>
+                  </processingCluster>
+                </pipelineAttributes>
+                <usedDataProducts>
+                  <item>
+                    <lofar:bfDataProduct topology="B0.2.T.SAP000.is">
+                    </lofar:bfDataProduct>
+                  </item>
+                </usedDataProducts>
+                <resultDataProducts>
+                  <item>
+                    <lofar:pulsarDataProduct>
+                      <name>B0.2.PT0.pu.dps</name>
+                      <topology>B0.2.PT0.pu.dps</topology>
+                      <status>no_data</status>
+                      <storageCluster>
+                      <name>CEP4</name>
+                      <partition>/data</partition>
+                    </storageCluster>
+                    </lofar:pulsarDataProduct>
+                  </item>
+                </resultDataProducts>
+              </lofar:pipeline>
+            </item>
+</children>
+  </lofar:folder>
+  </item>
+          </children>
+  </lofar:project>