diff --git a/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py b/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py
index 138bd8cbfaae7da91294fa78bf31f1989ad1689e..d1a53b791b34a2b5c53cd80ca24c3f54258b9ab8 100644
--- a/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py
+++ b/CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py
@@ -304,21 +304,21 @@ class HolographyDataset():
             raise Exception('Station %s was not involved in the observation.'
                             % station_name, )
 
-        if len(mode) > 1:
-            raise ValueError('Multiple RCUs mode are not supported')
-        else:
+        if len(mode) == 1:
             self.mode = mode.pop()
+        else:
+            raise ValueError('Multiple RCUs mode are not supported')
 
-        if len(source_position) > 1:
+        if len(source_position) == 1:
+            self.source_position = source_position.pop()
+        else:
             logger.error('Multiple source positions are not supported: %s', source_position)
             raise ValueError('Multiple source positions are not supported')
-        else:
-            self.source_position = source_position.pop()
 
-        if len(source_name) > 1:
-            raise ValueError('Multiple source name are not supported')
-        else:
+        if len(source_name) == 1:
             self.source_name = source_name.pop()
+        else:
+            raise ValueError('Multiple source name are not supported')
 
     @staticmethod
     def print_info(hds=None, text=None):
diff --git a/CAL/CalibrationCommon/lib/datacontainers/holography_measurementset.py b/CAL/CalibrationCommon/lib/datacontainers/holography_measurementset.py
index 0004b3a014ba19efce359b7b35fb3429dd65300f..b3578caf664fdde4b5c383d65ecfe366f745ee6c 100644
--- a/CAL/CalibrationCommon/lib/datacontainers/holography_measurementset.py
+++ b/CAL/CalibrationCommon/lib/datacontainers/holography_measurementset.py
@@ -19,13 +19,13 @@ class HolographyMeasurementSet(object):
     def __init__(self, ms_name, ms_path):
         self.path = os.path.join(ms_path, ms_name)
 
-        if not HolographyMeasurementSet.is_a_valid_ms_name(ms_name):
+        if HolographyMeasurementSet.is_a_valid_ms_name(ms_name):
+            self.name = ms_name
+            self.sas_id, self.beamlet = \
+                HolographyMeasurementSet.parse_sas_id_and_sub_band_from_ms_name(self.name)
+        else:
             raise ValueError('The measurement set located in %s has not a valid name' % self.path, )
 
-        self.name = ms_name
-        self.sas_id, self.beamlet = \
-            HolographyMeasurementSet.parse_sas_id_and_sub_band_from_ms_name(self.name)
-
     def get_frequency(self):
         observation_table = self.get_spectral_window_table()
         try:
@@ -94,10 +94,10 @@ class HolographyMeasurementSet(object):
         try:
             unique_names = {name for name in pointing_table.getcol('NAME')}
 
-            if len(unique_names) > 1:
-                raise ValueError('Expected only a source as a target for the observation')
-            else:
+            if len(unique_names) == 1:
                 source_name = unique_names.pop()
+            else:
+                raise ValueError('Expected only a source as a target for the observation')
         finally:
             pointing_table.close()
 
@@ -255,23 +255,23 @@ class HolographyMeasurementSet(object):
     def _compute_lm_from_ra_dec_station_position_rotation_matrix_and_time(ra_dec_epoch,
                                                                           rotation_matrix,
                                                                           mjd_times):
-
-        if not isinstance(ra_dec_epoch, numpy.ndarray):
+        if isinstance(ra_dec_epoch, numpy.ndarray):
+            ra, dec, epoch = ra_dec_epoch.tolist()
+
+            astropy_times = [HolographyMeasurementSet.__mjd_to_astropy_time(mjd_time)
+                             for mjd_time in mjd_times]
+            n_samples = len(astropy_times)
+            return_value_dtype = [('l', numpy.float64),
+                                  ('m', numpy.float64)]
+
+            return_value = numpy.empty(n_samples, dtype=return_value_dtype)
+            l_m_arrays = pqr_from_icrs(numpy.array((ra, dec)), astropy_times, rotation_matrix)
+    
+            return_value['l'][:] = l_m_arrays[:, 0]
+            return_value['m'][:] = l_m_arrays[:, 1]
+        else:
             raise TypeError('Expected a structured numpy array for ra_dec obtained {}'.
                             format(ra_dec_epoch))
-        ra, dec, epoch = ra_dec_epoch.tolist()
-
-        astropy_times = [HolographyMeasurementSet.__mjd_to_astropy_time(mjd_time)
-                         for mjd_time in mjd_times]
-        n_samples = len(astropy_times)
-        return_value_dtype = [('l', numpy.float64),
-                              ('m', numpy.float64)]
-
-        return_value = numpy.empty(n_samples, dtype=return_value_dtype)
-        l_m_arrays = pqr_from_icrs(numpy.array((ra, dec)), astropy_times, rotation_matrix)
-
-        return_value['l'][:] = l_m_arrays[:, 0]
-        return_value['m'][:] = l_m_arrays[:, 1]
 
         return return_value
 
@@ -283,9 +283,10 @@ class HolographyMeasurementSet(object):
 
     @staticmethod
     def parse_sas_id_and_sub_band_from_ms_name(ms_name):
-        if not HolographyMeasurementSet.is_a_valid_ms_name(ms_name):
+        if HolographyMeasurementSet.is_a_valid_ms_name(ms_name):
+            match = re.match(HolographyMeasurementSet.ms_name_pattern, ms_name)
+        else:
             raise ValueError('The measurement set %s has not a valid name' % ms_name, )
-        match = re.match(HolographyMeasurementSet.ms_name_pattern, ms_name)
         return str(match.group('sas_id')), int(match.group('sub_band_id'))
 
     @staticmethod
diff --git a/CAL/CalibrationCommon/lib/datacontainers/holography_observation.py b/CAL/CalibrationCommon/lib/datacontainers/holography_observation.py
index 14236e02c8acea713b2c2ec5faab4592d64aca23..0261e39466576e57b4bc1b6c46b63677c85b7957 100644
--- a/CAL/CalibrationCommon/lib/datacontainers/holography_observation.py
+++ b/CAL/CalibrationCommon/lib/datacontainers/holography_observation.py
@@ -117,31 +117,29 @@ class HolographyObservation():
                     extract_unique_reference_frequencies_from_ms_list(
                     ms_indexed_per_beamlet_number.values())
 
-                if len(unique_frequencies) > 1:
+                if len(unique_frequencies) == 1:
+                    frequency = unique_frequencies.pop()
+                else:
                     raise ValueError(
                         'Multiple reference frequencies per observation are not supported')
-                else:
-                    frequency = unique_frequencies.pop()
 
                 unique_source_names = HolographyObservation.\
                     extract_unique_source_names_from_ms_list(ms_indexed_per_beamlet_number.values())
 
-                if len(unique_source_names) > 1:
-                    raise ValueError(
-                        'Multiple source target per observation are not supported'
-                    )
-                else:
+                if len(unique_source_names) == 1:
                     source_name = unique_source_names.pop()
+                else:
+                    raise ValueError(
+                        'Multiple source target per observation are not supported')
 
                 unique_subband = HolographyObservation.\
                     extract_unique_subband_from_ms_list(ms_indexed_per_beamlet_number.values())
 
-                if len(unique_subband) > 1:
-                    raise ValueError(
-                        'Multiple subband per observation are not supported'
-                    )
-                else:
+                if len(unique_subband) == 1:
                     sub_band = unique_subband.pop()
+                else:
+                    raise ValueError(
+                        'Multiple subband per observation are not supported')
 
                 observations_list.append(
                     HolographyObservation(path, sas_id, ms_indexed_per_beamlet_number,
diff --git a/CAL/CalibrationCommon/lib/utils.py b/CAL/CalibrationCommon/lib/utils.py
index 57b5ec038fa091132e1c97f3998fffc21ee7422f..31f75e2284ed09892f9af05b63f7e473811ac3b5 100644
--- a/CAL/CalibrationCommon/lib/utils.py
+++ b/CAL/CalibrationCommon/lib/utils.py
@@ -14,12 +14,12 @@ def is_observation_in_range(start, end, from_datetime, to_datetime):
     :return: true if the observation is contained in the range false otherwise
     :raises: ValueError if start > end
     """
-    if start > end:
+    if start <= end:
+        start_in_range = from_datetime < start < to_datetime
+        end_in_range = from_datetime < end < to_datetime
+    else:
         raise ValueError('start datetime is greater then end datetime')
 
-    start_in_range = from_datetime < start < to_datetime
-    end_in_range = from_datetime < end < to_datetime
-
     return start_in_range and end_in_range