diff --git a/ArchiveExtractor.py b/ArchiveExtractor.py
index cd780d47c25fa95f474cd99c89e51ff89cc15bb9..13b6211596cf2938de060b44bae6da4d5c4a1896 100755
--- a/ArchiveExtractor.py
+++ b/ArchiveExtractor.py
@@ -13,20 +13,20 @@ import PyTango as tango
 
 __version__ = "1.0.1"
 
-class ArchiveExtractor:
+##########################################################################
+""" Commodity variables """
 
-    ##########################################################################
-    """ Commodity variables """
+# Extractor date format for GetAttDataBetweenDates
+DBDFMT = "%Y-%m-%d %H:%M:%S"
 
-    # Extractor date format for GetAttDataBetweenDates
-    DBDFMT = "%Y-%m-%d %H:%M:%S"
+# Extractor date format for GetNearestValue
+DBDFMT2 = "%d-%m-%Y %H:%M:%S"
 
-    # Extractor date format for GetNearestValue
-    DBDFMT2 = "%d-%m-%Y %H:%M:%S"
+# Vectorized fromtimestamp function
+ArrayTimeStampToDatetime = np.vectorize(datetime.datetime.fromtimestamp)
 
-    # Vectorized fromtimestamp function
-    ArrayTimeStampToDatetime = np.vectorize(datetime.datetime.fromtimestamp)
 
+class ArchiveExtractor:
     # Max number of point per extraction chunks
     Nmax = 100000
 
@@ -66,7 +66,9 @@ class ArchiveExtractor:
         #######################################################
         # Select Extractor
         if ExtractorPath is None:
-            self.extractor = "archiving/%sDBExtractor/%d"%(ExtractKind, ExtractorNumber)
+            self.extractor = tango.DeviceProxy(
+                    "archiving/%sDBExtractor/%d"%(ExtractorKind, ExtractorNumber)
+                    )
         else:
             self.extractor = tango.DeviceProxy(ExtractorPath)
 
@@ -158,41 +160,14 @@ class ArchiveExtractor:
             Number of points on the date range.
 
         """
-        # Check that the attribute is in the database
-        self.logger.debug("Check that %s is archived."%attribute)
-        if not self.extractor.IsArchived(attribute):
-            self.logger.error("Attribute '%s' is not archived in DB %s"%(attribute, extractor))
-            raise ValueError("Attribute '%s' is not archived in DB %s"%(attribute, extractor))
-
-        # Get its sampling period in seconds
-        req=self.extractor.GetArchivingMode(attribute)
-        self.logger.debug("GetArchivingMode: "+str(req))
-
-        if req[0] == "MODE_P":
-            samplingPeriod = int(req[1])*10**-3
-            self.logger.debug("Attribute is sampled every %g seconds"%samplingPeriod)
-
-        elif req[0] == "MODE_EVT":
-            self.logger.warning("Attribute is archived on event. Chunks of data are sized with an estimated datarate of 0.1Hz")
-            samplingPeriod = 10
-
-        else:
-            self.logger.error("Archive mode not implemented in this script")
-            raise NotImplemented("Archive mode not implemented in this script")
-
-
-        # Evaluate the number of points
-        N = (dateStop-dateStart).total_seconds()/samplingPeriod
-        self.logger.debug("Which leads to %d points to extract."%est_N)
-
         return N
 
 
 
     ##---------------------------------------------------------------------------##
-    def BetweenDates(
+    def betweenDates(
             self,
-            attr,
+            attribute,
             dateStart,
             dateStop=datetime.datetime.now(),
             ):
@@ -205,11 +180,11 @@ class ArchiveExtractor:
         attr : String
             Name of the attribute. Full Tango name i.e. "test/dg/panda/current".
 
-        dateStart : datetime.datetime
-            Start date for extraction.
+        dateStart : datetime.datetime, string
+            Start date for extraction. If string, it will be parsed.
 
-        dateStop : datetime.datetime
-            Stop date for extraction.
+        dateStop : datetime.datetime, string
+            Stop date for extraction. If string, it will be parsed.
             Default is now (datetime.datetime.now())
 
         Exceptions
@@ -227,12 +202,47 @@ class ArchiveExtractor:
 
         """
 
-        # Check and estimate the number of points
-        est_N = self.evalPoints(attribute, dateStart, dateStop)
+        # Parse date if it is string
+        if type(dateStart) is str:
+            dateStart = self.dateparse(dateStart)
+        if type(dateStop) is str:
+            dateStop = self.dateparse(dateStop)
+
+        # Check that the attribute is in the database
+        self.logger.debug("Check that %s is archived."%attribute)
+        if not self.extractor.IsArchived(attribute):
+            self.logger.error("Attribute '%s' is not archived in DB %s"%(attribute, extractor))
+            raise ValueError("Attribute '%s' is not archived in DB %s"%(attribute, extractor))
+
+        # Get its sampling period in seconds
+        req=self.extractor.GetArchivingMode(attribute)
+        self.logger.debug("GetArchivingMode: "+str(req))
+
+        if req[0] == "MODE_P":
+            samplingPeriod = int(req[1])*10**-3
+            self.logger.debug("Attribute is sampled every %g seconds"%samplingPeriod)
+
+        elif req[0] == "MODE_EVT":
+            self.logger.warning("Attribute is archived on event. Chunks of data are sized with an estimated datarate of 0.1Hz")
+            samplingPeriod = 10
+
+        else:
+            self.logger.error("Archive mode not implemented in this script")
+            raise NotImplemented("Archive mode not implemented in this script")
+
+
+        # Get the number of points
+        N=self.extractor.GetAttDataBetweenDatesCount([
+                attribute,
+                dateStart.strftime(DBDFMT2),
+                dateStop.strftime(DBDFMT2)
+                ])
+        self.logger.debug("On the period, there is %d entries"%N)
 
         # If data chunk is too much, we need to cut it
-        if est_N > Nmax:
-            dt = datetime.timedelta(seconds=samplingPeriod)*Nmax
+        if N > self.Nmax:
+            dt = datetime.timedelta(seconds=samplingPeriod)*self.Nmax
+            dt = (dateStop-dateStart)/(N//self.Nmax)
             cdates = [dateStart]
             while cdates[-1] < dateStop:
                 cdates.append(cdates[-1]+dt)
@@ -249,13 +259,13 @@ class ArchiveExtractor:
         for i_d in range(len(cdates)-1):
             # Make retrieval request
             self.logger.debug("Perform ExtractBetweenDates (%s, %s, %s)"%(
-                attr,
+                attribute,
                 cdates[i_d].strftime(DBDFMT),
                 cdates[i_d+1].strftime(DBDFMT))
                 )
 
             _date, _value = self.extractor.ExtractBetweenDates([
-                attr,
+                attribute,
                 cdates[i_d].strftime(DBDFMT),
                 cdates[i_d+1].strftime(DBDFMT)
                 ])
@@ -273,7 +283,7 @@ class ArchiveExtractor:
         date = np.concatenate(date)
 
 
-        self.logger.debug("Extraction done for %s."%attr)
+        self.logger.debug("Extraction done for %s."%attribute)
         return [date, value]
 
     ##---------------------------------------------------------------------------##