diff --git a/ADbasic_program_buffered.bas b/ADbasic_program_buffered.bas
index 9c5debde45983f5208e0b2f293488638f734bc70..0af484a687f760defbb705ff6fb22284bd1bdcec 100644
--- a/ADbasic_program_buffered.bas
+++ b/ADbasic_program_buffered.bas
@@ -12,7 +12,6 @@
 ' Info_Last_Save                 = QI-ADWIN  QI-ADWIN\labuser
 '<Header End>
 #include adwinpro_all.inc
-Import Math.LIC
 
 ' Array Size Settings
 ' TODO: check these values in labscript_devices files
@@ -55,7 +54,6 @@ DIM DATA_30[MAX_PID_EVENTS] AS LONG         'PID start values
 DIM DATA_7[AINNO] AS LONG               'Start times for channel recording
 DIM DATA_8[AINNO] AS LONG               'End times for channel recording
 DIM DATA_9[AINNO] AS LONG               'Gain modes for AIN channels
-DIM DATA_19[AINNO] AS LONG              'Storage rate for AIN channels
 DIM DATA_199[A_IN_BUFFER+16] AS LONG    'Recorded Data - add padding at the end to ensure no overflow happens
 DIM ain_index[AINNO] AS LONG            'Index of the data acquisition for each channel, to have the values sorted
 
@@ -104,7 +102,6 @@ DIM set_target[AOUTNO] AS LONG  ' Set values to be written to AOUTs
 DIM set_output[AOUTNO] AS LONG  ' Set values to be written to AOUTs
 DIM set_pid[AOUTNO] AS LONG    ' PID selection for each AOUT
 DIM act_values[PIDNO] AS LONG   ' Analog values measured from AINs
-DIM ain_rate[AINNO] AS LONG     ' How often should the AIN value be stored for each channel, combined with DATA_7 and DATA_8
 
 
 '=========================================================================
@@ -208,13 +205,8 @@ init:
   
   'Determine indices for analog data acquisition
   ain_index[1] = 1
-  ain_rate[1] = Round(1e9 / PROCESSDELAY / DATA_19[1])
   FOR i=2 TO AINNO
-    ain_index[i] = ain_index[i-1] + ((DATA_8[i-1] - DATA_7[i-1]) / ain_rate[i-1])
-    IF (Mod(DATA_8[i-1] - DATA_7[i-1],ain_rate[i-1]) <> 0) THEN
-      ain_index[i] = ain_index[i] + 1
-    ENDIF
-    ain_rate[i] = Round(1e9 / PROCESSDELAY / DATA_19[i])
+    ain_index[i] = ain_index[i-1] + DATA_8[i-1] - DATA_7[i-1]
   NEXT i
 
 
@@ -307,10 +299,8 @@ EVENT:
   FOR i=1 to AINNO
     IF(processIdx < DATA_8[i]) THEN
       IF (processIdx >= DATA_7[i]) THEN
-        ' IF (Mod(processIdx-DATA_7[i], ain_rate[i]) = 0) THEN 
         DATA_199[ain_index[i]]=act_values[i]
         inc ain_index[i]
-        ' ENDIF
       ENDIF 'processIdx > DATA_7[i]
     ENDIF 'processIdx <= DATA_8[i]
   NEXT i