diff --git a/include/AmptekHardwareInterface.h b/include/AmptekHardwareInterface.h
index a4416a673fc862ce7927186c1554a33b88bca2ec..544ffdd331339f2147d4a9cfaf0f14323ab799c0 100644
--- a/include/AmptekHardwareInterface.h
+++ b/include/AmptekHardwareInterface.h
@@ -47,8 +47,12 @@ public:
     bool ResetListModeTimer();
     bool DisableListMode();
 
+    bool startBuffering();
+    bool stopBuffering();
+    std::vector<unsigned int> GetBuffered(size_t id);
+
     bool StartCommtestStreaming(uint16_t min_channel,uint16_t max_channel, 
-                                    uint16_t increment, uint16_t rate);
+                                    uint16_t increment, uint32_t rate);
     bool StopCommtestStreaming();
 
     int FastCount(double max_age_ms = 100);
diff --git a/include/packet.h b/include/packet.h
index 040fd6387073bc1082540154fc53feb19ee7045a..92f0d0e20b9e180e0488c677dc3cc38239cd87fc 100644
--- a/include/packet.h
+++ b/include/packet.h
@@ -42,6 +42,7 @@ enum PID1_TYPE{
 };
 
 
+
 // Packet ID second byte (one enum per group)
 
 enum PID2_SUBTYPE_STATUS_REQUEST{
diff --git a/python/AmptekHardwareInterface.py b/python/AmptekHardwareInterface.py
index 9e494939473b0d591f6e9122d0bf3c96d292752b..11c98d754dd64c2019e42f3debe434af27d00b7a 100644
--- a/python/AmptekHardwareInterface.py
+++ b/python/AmptekHardwareInterface.py
@@ -1,22 +1,15 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 3.0.12
+# Version 3.0.8
 #
 # Do not make changes to this file unless you know what you are doing--modify
 # the SWIG interface file instead.
 
-from sys import version_info as _swig_python_version_info
-if _swig_python_version_info >= (2, 7, 0):
-    def swig_import_helper():
-        import importlib
-        pkg = __name__.rpartition('.')[0]
-        mname = '.'.join((pkg, '_AmptekHardwareInterface')).lstrip('.')
-        try:
-            return importlib.import_module(mname)
-        except ImportError:
-            return importlib.import_module('_AmptekHardwareInterface')
-    _AmptekHardwareInterface = swig_import_helper()
-    del swig_import_helper
-elif _swig_python_version_info >= (2, 6, 0):
+
+
+
+
+from sys import version_info
+if version_info >= (2, 6, 0):
     def swig_import_helper():
         from os.path import dirname
         import imp
@@ -26,27 +19,22 @@ elif _swig_python_version_info >= (2, 6, 0):
         except ImportError:
             import _AmptekHardwareInterface
             return _AmptekHardwareInterface
-        try:
-            _mod = imp.load_module('_AmptekHardwareInterface', fp, pathname, description)
-        finally:
-            if fp is not None:
+        if fp is not None:
+            try:
+                _mod = imp.load_module('_AmptekHardwareInterface', fp, pathname, description)
+            finally:
                 fp.close()
-        return _mod
+            return _mod
     _AmptekHardwareInterface = swig_import_helper()
     del swig_import_helper
 else:
     import _AmptekHardwareInterface
-del _swig_python_version_info
-
+del version_info
 try:
     _swig_property = property
 except NameError:
     pass  # Python < 2.2 doesn't have 'property'.
 
-try:
-    import builtins as __builtin__
-except ImportError:
-    import __builtin__
 
 def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
     if (name == "thisown"):
@@ -68,22 +56,37 @@ def _swig_setattr(self, class_type, name, value):
     return _swig_setattr_nondynamic(self, class_type, name, value, 0)
 
 
-def _swig_getattr(self, class_type, name):
+def _swig_getattr_nondynamic(self, class_type, name, static=1):
     if (name == "thisown"):
         return self.this.own()
     method = class_type.__swig_getmethods__.get(name, None)
     if method:
         return method(self)
-    raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
+    if (not static):
+        return object.__getattr__(self, name)
+    else:
+        raise AttributeError(name)
+
+def _swig_getattr(self, class_type, name):
+    return _swig_getattr_nondynamic(self, class_type, name, 0)
 
 
 def _swig_repr(self):
     try:
         strthis = "proxy of " + self.this.__repr__()
-    except __builtin__.Exception:
+    except Exception:
         strthis = ""
     return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
 
+try:
+    _object = object
+    _newclass = 1
+except AttributeError:
+    class _object:
+        pass
+    _newclass = 0
+
+
 
 def _swig_setattr_nondynamic_method(set):
     def set_attr(self, name, value):
@@ -236,7 +239,7 @@ class IntVector(object):
         this = _AmptekHardwareInterface.new_IntVector(*args)
         try:
             self.this.append(this)
-        except __builtin__.Exception:
+        except Exception:
             self.this = this
 
     def push_back(self, x):
@@ -346,7 +349,7 @@ class StringVector(object):
         this = _AmptekHardwareInterface.new_StringVector(*args)
         try:
             self.this.append(this)
-        except __builtin__.Exception:
+        except Exception:
             self.this = this
 
     def push_back(self, x):
@@ -456,7 +459,7 @@ class DoubleVector(object):
         this = _AmptekHardwareInterface.new_DoubleVector(*args)
         try:
             self.this.append(this)
-        except __builtin__.Exception:
+        except Exception:
             self.this = this
 
     def push_back(self, x):
@@ -566,7 +569,7 @@ class UIntVector(object):
         this = _AmptekHardwareInterface.new_UIntVector(*args)
         try:
             self.this.append(this)
-        except __builtin__.Exception:
+        except Exception:
             self.this = this
 
     def push_back(self, x):
@@ -597,11 +600,23 @@ class UIntVector(object):
 UIntVector_swigregister = _AmptekHardwareInterface.UIntVector_swigregister
 UIntVector_swigregister(UIntVector)
 
+
+_AmptekHardwareInterface.STATUS_SIZE_swigconstant(_AmptekHardwareInterface)
 STATUS_SIZE = _AmptekHardwareInterface.STATUS_SIZE
+
+_AmptekHardwareInterface.SPECLEN_swigconstant(_AmptekHardwareInterface)
 SPECLEN = _AmptekHardwareInterface.SPECLEN
+
+_AmptekHardwareInterface.NOT_CONNECTED_swigconstant(_AmptekHardwareInterface)
 NOT_CONNECTED = _AmptekHardwareInterface.NOT_CONNECTED
+
+_AmptekHardwareInterface.ON_swigconstant(_AmptekHardwareInterface)
 ON = _AmptekHardwareInterface.ON
+
+_AmptekHardwareInterface.RECORDING_swigconstant(_AmptekHardwareInterface)
 RECORDING = _AmptekHardwareInterface.RECORDING
+
+_AmptekHardwareInterface.ERROR_swigconstant(_AmptekHardwareInterface)
 ERROR = _AmptekHardwareInterface.ERROR
 class AmptekHardwareInterface(object):
     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
@@ -611,7 +626,7 @@ class AmptekHardwareInterface(object):
         this = _AmptekHardwareInterface.new_AmptekHardwareInterface()
         try:
             self.this.append(this)
-        except __builtin__.Exception:
+        except Exception:
             self.this = this
     __swig_destroy__ = _AmptekHardwareInterface.delete_AmptekHardwareInterface
     __del__ = lambda self: None
@@ -667,6 +682,15 @@ class AmptekHardwareInterface(object):
     def DisableListMode(self):
         return _AmptekHardwareInterface.AmptekHardwareInterface_DisableListMode(self)
 
+    def startBuffering(self):
+        return _AmptekHardwareInterface.AmptekHardwareInterface_startBuffering(self)
+
+    def stopBuffering(self):
+        return _AmptekHardwareInterface.AmptekHardwareInterface_stopBuffering(self)
+
+    def GetBuffered(self, id):
+        return _AmptekHardwareInterface.AmptekHardwareInterface_GetBuffered(self, id)
+
     def StartCommtestStreaming(self, min_channel, max_channel, increment, rate):
         return _AmptekHardwareInterface.AmptekHardwareInterface_StartCommtestStreaming(self, min_channel, max_channel, increment, rate)
 
diff --git a/python/AmptekHardwareInterface_wrap.cpp b/python/AmptekHardwareInterface_wrap.cpp
index f8c3852194a6bc32d0395364fb28c136de20aebc..314ff42e500f5088fc780ca0b8107fe1e4fd3901 100644
--- a/python/AmptekHardwareInterface_wrap.cpp
+++ b/python/AmptekHardwareInterface_wrap.cpp
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 3.0.12
+ * Version 3.0.8
  *
  * This file is not intended to be easily readable and contains a number of
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -106,11 +106,9 @@ template <typename T> T SwigValueInit() {
 #endif
 
 /* exporting methods */
-#if defined(__GNUC__)
-#  if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-#    ifndef GCC_HASCLASSVISIBILITY
-#      define GCC_HASCLASSVISIBILITY
-#    endif
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
 #  endif
 #endif
 
@@ -670,16 +668,16 @@ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
     char d = *(c++);
     unsigned char uu;
     if ((d >= '0') && (d <= '9'))
-      uu = (unsigned char)((d - '0') << 4);
+      uu = ((d - '0') << 4);
     else if ((d >= 'a') && (d <= 'f'))
-      uu = (unsigned char)((d - ('a'-10)) << 4);
+      uu = ((d - ('a'-10)) << 4);
     else
       return (char *) 0;
     d = *(c++);
     if ((d >= '0') && (d <= '9'))
-      uu |= (unsigned char)(d - '0');
+      uu |= (d - '0');
     else if ((d >= 'a') && (d <= 'f'))
-      uu |= (unsigned char)(d - ('a'-10));
+      uu |= (d - ('a'-10));
     else
       return (char *) 0;
     *u = uu;
@@ -862,6 +860,10 @@ PyString_FromFormat(const char *fmt, ...) {
 }
 #endif
 
+/* Add PyObject_Del for old Pythons */
+#if PY_VERSION_HEX < 0x01060000
+# define PyObject_Del(op) PyMem_DEL((op))
+#endif
 #ifndef PyObject_DEL
 # define PyObject_DEL PyObject_Del
 #endif
@@ -976,7 +978,6 @@ typedef destructor freefunc;
 #if PY_VERSION_HEX < 0x03020000
 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
 #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
-#define Py_hash_t long
 #endif
 
 /* -----------------------------------------------------------------------------
@@ -1925,6 +1926,7 @@ SwigPyObject_TypeOnce(void) {
   static int type_init = 0;
   if (!type_init) {
     const PyTypeObject tmp = {
+      /* PyObject header changed in Python 3 */
 #if PY_VERSION_HEX >= 0x03000000
       PyVarObject_HEAD_INIT(NULL, 0)
 #else
@@ -1935,7 +1937,7 @@ SwigPyObject_TypeOnce(void) {
       sizeof(SwigPyObject),                 /* tp_basicsize */
       0,                                    /* tp_itemsize */
       (destructor)SwigPyObject_dealloc,     /* tp_dealloc */
-      0,                                    /* tp_print */
+      0,				    /* tp_print */
 #if PY_VERSION_HEX < 0x02020000
       (getattrfunc)SwigPyObject_getattr,    /* tp_getattr */
 #else
@@ -1943,7 +1945,7 @@ SwigPyObject_TypeOnce(void) {
 #endif
       (setattrfunc)0,                       /* tp_setattr */
 #if PY_VERSION_HEX >= 0x03000000
-      0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
+    0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
 #else
       (cmpfunc)SwigPyObject_compare,        /* tp_compare */
 #endif
@@ -1953,7 +1955,7 @@ SwigPyObject_TypeOnce(void) {
       0,                                    /* tp_as_mapping */
       (hashfunc)0,                          /* tp_hash */
       (ternaryfunc)0,                       /* tp_call */
-      0,                                    /* tp_str */
+      0,				    /* tp_str */
       PyObject_GenericGetAttr,              /* tp_getattro */
       0,                                    /* tp_setattro */
       0,                                    /* tp_as_buffer */
@@ -2116,6 +2118,7 @@ SwigPyPacked_TypeOnce(void) {
   static int type_init = 0;
   if (!type_init) {
     const PyTypeObject tmp = {
+      /* PyObject header changed in Python 3 */
 #if PY_VERSION_HEX>=0x03000000
       PyVarObject_HEAD_INIT(NULL, 0)
 #else
@@ -3060,7 +3063,7 @@ static swig_module_info swig_module = {swig_types, 26, 0, 0, 0, 0};
 #endif
 #define SWIG_name    "_AmptekHardwareInterface"
 
-#define SWIGVERSION 0x030012 
+#define SWIGVERSION 0x030008 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -3171,7 +3174,6 @@ namespace swig {
 #endif
 
 
-#include <typeinfo>
 #include <stdexcept>
 
 
@@ -3321,7 +3323,7 @@ SWIG_AsVal_double (PyObject *obj, double *val)
     return SWIG_OK;
 #if PY_VERSION_HEX < 0x03000000
   } else if (PyInt_Check(obj)) {
-    if (val) *val = (double) PyInt_AsLong(obj);
+    if (val) *val = PyInt_AsLong(obj);
     return SWIG_OK;
 #endif
   } else if (PyLong_Check(obj)) {
@@ -3442,109 +3444,23 @@ SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val)
 }
 
 
-#include <limits.h>
-#if !defined(SWIG_NO_LLONG_MAX)
-# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
-#   define LLONG_MAX __LONG_LONG_MAX__
-#   define LLONG_MIN (-LLONG_MAX - 1LL)
-#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
-# endif
-#endif
-
-
-#if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE)
-#  define SWIG_LONG_LONG_AVAILABLE
-#endif
-
-
-#ifdef SWIG_LONG_LONG_AVAILABLE
-SWIGINTERN int
-SWIG_AsVal_unsigned_SS_long_SS_long (PyObject *obj, unsigned long long *val)
-{
-  int res = SWIG_TypeError;
-  if (PyLong_Check(obj)) {
-    unsigned long long v = PyLong_AsUnsignedLongLong(obj);
-    if (!PyErr_Occurred()) {
-      if (val) *val = v;
-      return SWIG_OK;
-    } else {
-      PyErr_Clear();
-      res = SWIG_OverflowError;
-    }
-  } else {
-    unsigned long v;
-    res = SWIG_AsVal_unsigned_SS_long (obj,&v);
-    if (SWIG_IsOK(res)) {
-      if (val) *val = v;
-      return res;
-    }
-  }
-#ifdef SWIG_PYTHON_CAST_MODE
-  {
-    const double mant_max = 1LL << DBL_MANT_DIG;
-    double d;
-    res = SWIG_AsVal_double (obj,&d);
-    if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, 0, mant_max))
-      return SWIG_OverflowError;
-    if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) {
-      if (val) *val = (unsigned long long)(d);
-      return SWIG_AddCast(res);
-    }
-    res = SWIG_TypeError;
-  }
-#endif
-  return res;
-}
-#endif
-
-
 SWIGINTERNINLINE int
 SWIG_AsVal_size_t (PyObject * obj, size_t *val)
 {
-  int res = SWIG_TypeError;
-#ifdef SWIG_LONG_LONG_AVAILABLE
-  if (sizeof(size_t) <= sizeof(unsigned long)) {
-#endif
-    unsigned long v;
-    res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
-    if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v);
-#ifdef SWIG_LONG_LONG_AVAILABLE
-  } else if (sizeof(size_t) <= sizeof(unsigned long long)) {
-    unsigned long long v;
-    res = SWIG_AsVal_unsigned_SS_long_SS_long (obj, val ? &v : 0);
-    if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v);
-  }
-#endif
+  unsigned long v;
+  int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
+  if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v);
   return res;
 }
 
 
-  #define SWIG_From_long   PyInt_FromLong 
-
-
-#ifdef SWIG_LONG_LONG_AVAILABLE
-SWIGINTERNINLINE PyObject* 
-SWIG_From_long_SS_long  (long long value)
-{
-  return ((value < LONG_MIN) || (value > LONG_MAX)) ?
-    PyLong_FromLongLong(value) : PyInt_FromLong(static_cast< long >(value));
-}
-#endif
+  #define SWIG_From_long   PyLong_FromLong 
 
 
 SWIGINTERNINLINE PyObject *
 SWIG_From_ptrdiff_t  (ptrdiff_t value)
 {    
-#ifdef SWIG_LONG_LONG_AVAILABLE
-  if (sizeof(ptrdiff_t) <= sizeof(long)) {
-#endif
-    return SWIG_From_long  (static_cast< long >(value));
-#ifdef SWIG_LONG_LONG_AVAILABLE
-  } else {
-    /* assume sizeof(ptrdiff_t) <= sizeof(long long) */
-    return SWIG_From_long_SS_long  (static_cast< long long >(value));
-  }
-#endif
+  return SWIG_From_long  (static_cast< long >(value));
 }
 
 
@@ -3598,65 +3514,12 @@ SWIG_AsVal_long (PyObject *obj, long* val)
 }
 
 
-#ifdef SWIG_LONG_LONG_AVAILABLE
-SWIGINTERN int
-SWIG_AsVal_long_SS_long (PyObject *obj, long long *val)
-{
-  int res = SWIG_TypeError;
-  if (PyLong_Check(obj)) {
-    long long v = PyLong_AsLongLong(obj);
-    if (!PyErr_Occurred()) {
-      if (val) *val = v;
-      return SWIG_OK;
-    } else {
-      PyErr_Clear();
-      res = SWIG_OverflowError;
-    }
-  } else {
-    long v;
-    res = SWIG_AsVal_long (obj,&v);
-    if (SWIG_IsOK(res)) {
-      if (val) *val = v;
-      return res;
-    }
-  }
-#ifdef SWIG_PYTHON_CAST_MODE
-  {
-    const double mant_max = 1LL << DBL_MANT_DIG;
-    const double mant_min = -mant_max;
-    double d;
-    res = SWIG_AsVal_double (obj,&d);
-    if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, mant_min, mant_max))
-      return SWIG_OverflowError;
-    if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, mant_min, mant_max)) {
-      if (val) *val = (long long)(d);
-      return SWIG_AddCast(res);
-    }
-    res = SWIG_TypeError;
-  }
-#endif
-  return res;
-}
-#endif
-
-
 SWIGINTERNINLINE int
 SWIG_AsVal_ptrdiff_t (PyObject * obj, ptrdiff_t *val)
 {
-  int res = SWIG_TypeError;
-#ifdef SWIG_LONG_LONG_AVAILABLE
-  if (sizeof(ptrdiff_t) <= sizeof(long)) {
-#endif
-    long v;
-    res = SWIG_AsVal_long (obj, val ? &v : 0);
-    if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v);
-#ifdef SWIG_LONG_LONG_AVAILABLE
-  } else if (sizeof(ptrdiff_t) <= sizeof(long long)) {
-    long long v;
-    res = SWIG_AsVal_long_SS_long (obj, val ? &v : 0);
-    if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v);
-  }
-#endif
+  long v;
+  int res = SWIG_AsVal_long (obj, val ? &v : 0);
+  if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v);
   return res;
 }
 
@@ -3694,21 +3557,8 @@ namespace swig {
     return traits<typename noconst_traits<Type >::noconst_type >::type_name();
   }
 
-  template <class Type> struct traits_info {
-    static swig_type_info *type_query(std::string name) {
-      name += " *";
-      return SWIG_TypeQuery(name.c_str());
-    }
-    static swig_type_info *type_info() {
-      static swig_type_info *info = type_query(type_name<Type>());
-      return info;
-    }
-  };
-
-  /*
-    Partial specialization for pointers (traits_info)
-  */
-  template <class Type> struct traits_info<Type *> {
+  template <class Type>
+  struct traits_info {
     static swig_type_info *type_query(std::string name) {
       name += " *";
       return SWIG_TypeQuery(name.c_str());
@@ -3725,7 +3575,7 @@ namespace swig {
   }
 
   /*
-    Partial specialization for pointers (traits)
+    Partial specialization for pointers
   */
   template <class Type> struct traits <Type *> {
     typedef pointer_category category;
@@ -3795,8 +3645,7 @@ namespace swig {
   struct traits_asptr {   
     static int asptr(PyObject *obj, Type **val) {
       Type *p;
-      swig_type_info *descriptor = type_info<Type>();
-      int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
+      int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0);
       if (SWIG_IsOK(res)) {
 	if (val) *val = p;
       }
@@ -3944,7 +3793,7 @@ namespace swig {
 
 namespace std {
   template <>
-  struct less <PyObject *>
+  struct less <PyObject *>: public binary_function<PyObject *, PyObject *, bool>
   {
     bool
     operator()(PyObject * v, PyObject *w) const
@@ -3969,7 +3818,7 @@ namespace std {
   };
 
   template <>
-  struct less <swig::SwigPtr_PyObject>
+  struct less <swig::SwigPtr_PyObject>: public binary_function<swig::SwigPtr_PyObject, swig::SwigPtr_PyObject, bool>
   {
     bool
     operator()(const swig::SwigPtr_PyObject& v, const swig::SwigPtr_PyObject& w) const
@@ -3979,7 +3828,7 @@ namespace std {
   };
 
   template <>
-  struct less <swig::SwigVar_PyObject>
+  struct less <swig::SwigVar_PyObject>: public binary_function<swig::SwigVar_PyObject, swig::SwigVar_PyObject, bool>
   {
     bool
     operator()(const swig::SwigVar_PyObject& v, const swig::SwigVar_PyObject& w) const
@@ -4042,7 +3891,7 @@ namespace swig {
     if (step == 0) {
       throw std::invalid_argument("slice step cannot be zero");
     } else if (step > 0) {
-      // Required range: 0 <= i < size, 0 <= j < size, i <= j
+      // Required range: 0 <= i < size, 0 <= j < size
       if (i < 0) {
         ii = 0;
       } else if (i < (Difference)size) {
@@ -4050,15 +3899,13 @@ namespace swig {
       } else if (insert && (i >= (Difference)size)) {
         ii = (Difference)size;
       }
-      if (j < 0) {
+      if ( j < 0 ) {
         jj = 0;
       } else {
         jj = (j < (Difference)size) ? j : (Difference)size;
       }
-      if (jj < ii)
-        jj = ii;
     } else {
-      // Required range: -1 <= i < size-1, -1 <= j < size-1, i >= j
+      // Required range: -1 <= i < size-1, -1 <= j < size-1
       if (i < -1) {
         ii = -1;
       } else if (i < (Difference) size) {
@@ -4071,8 +3918,6 @@ namespace swig {
       } else {
         jj = (j < (Difference)size ) ? j : (Difference)(size-1);
       }
-      if (ii < jj)
-        ii = jj;
     }
   }
 
@@ -4098,13 +3943,6 @@ namespace swig {
     seq->erase(position);
   }
 
-  template <class Sequence>
-  struct traits_reserve {
-    static void reserve(Sequence & /*seq*/, typename Sequence::size_type /*n*/) {
-      // This should be specialized for types that support reserve
-    }
-  };
-
   template <class Sequence, class Difference>
   inline Sequence*
   getslice(const Sequence* self, Difference i, Difference j, Py_ssize_t step) {
@@ -4122,7 +3960,6 @@ namespace swig {
         return new Sequence(sb, se);
       } else {
         Sequence *sequence = new Sequence();
-        swig::traits_reserve<Sequence>::reserve(*sequence, (jj - ii + step - 1) / step);
         typename Sequence::const_iterator it = sb;
         while (it!=se) {
           sequence->push_back(*it);
@@ -4133,16 +3970,17 @@ namespace swig {
       } 
     } else {
       Sequence *sequence = new Sequence();
-      swig::traits_reserve<Sequence>::reserve(*sequence, (ii - jj - step - 1) / -step);
-      typename Sequence::const_reverse_iterator sb = self->rbegin();
-      typename Sequence::const_reverse_iterator se = self->rbegin();
-      std::advance(sb,size-ii-1);
-      std::advance(se,size-jj-1);
-      typename Sequence::const_reverse_iterator it = sb;
-      while (it!=se) {
-        sequence->push_back(*it);
-        for (Py_ssize_t c=0; c<-step && it!=se; ++c)
-          it++;
+      if (ii > jj) {
+        typename Sequence::const_reverse_iterator sb = self->rbegin();
+        typename Sequence::const_reverse_iterator se = self->rbegin();
+        std::advance(sb,size-ii-1);
+        std::advance(se,size-jj-1);
+        typename Sequence::const_reverse_iterator it = sb;
+        while (it!=se) {
+          sequence->push_back(*it);
+          for (Py_ssize_t c=0; c<-step && it!=se; ++c)
+            it++;
+        }
       }
       return sequence;
     }
@@ -4156,11 +3994,12 @@ namespace swig {
     Difference jj = 0;
     swig::slice_adjust(i, j, step, size, ii, jj, true);
     if (step > 0) {
+      if (jj < ii)
+        jj = ii;
       if (step == 1) {
         size_t ssize = jj - ii;
         if (ssize <= is.size()) {
           // expanding/staying the same size
-          swig::traits_reserve<Sequence>::reserve(*self, self->size() - ssize + is.size());
           typename Sequence::iterator sb = self->begin();
           typename InputSeq::const_iterator isit = is.begin();
           std::advance(sb,ii);
@@ -4194,6 +4033,8 @@ namespace swig {
         }
       }
     } else {
+      if (jj > ii)
+        jj = ii;
       size_t replacecount = (ii - jj - step - 1) / -step;
       if (is.size() != replacecount) {
         char msg[1024];
@@ -4219,33 +4060,37 @@ namespace swig {
     Difference jj = 0;
     swig::slice_adjust(i, j, step, size, ii, jj, true);
     if (step > 0) {
-      typename Sequence::iterator sb = self->begin();
-      std::advance(sb,ii);
-      if (step == 1) {
-        typename Sequence::iterator se = self->begin();
-        std::advance(se,jj);
-        self->erase(sb,se);
-      } else {
-        typename Sequence::iterator it = sb;
-        size_t delcount = (jj - ii + step - 1) / step;
+      if (jj > ii) {
+        typename Sequence::iterator sb = self->begin();
+        std::advance(sb,ii);
+        if (step == 1) {
+          typename Sequence::iterator se = self->begin();
+          std::advance(se,jj);
+          self->erase(sb,se);
+        } else {
+          typename Sequence::iterator it = sb;
+          size_t delcount = (jj - ii + step - 1) / step;
+          while (delcount) {
+            it = self->erase(it);
+            for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c)
+              it++;
+            delcount--;
+          }
+        }
+      }
+    } else {
+      if (ii > jj) {
+        typename Sequence::reverse_iterator sb = self->rbegin();
+        std::advance(sb,size-ii-1);
+        typename Sequence::reverse_iterator it = sb;
+        size_t delcount = (ii - jj - step - 1) / -step;
         while (delcount) {
-          it = self->erase(it);
-          for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c)
+          it = typename Sequence::reverse_iterator(self->erase((++it).base()));
+          for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c)
             it++;
           delcount--;
         }
       }
-    } else {
-      typename Sequence::reverse_iterator sb = self->rbegin();
-      std::advance(sb,size-ii-1);
-      typename Sequence::reverse_iterator it = sb;
-      size_t delcount = (ii - jj - step - 1) / -step;
-      while (delcount) {
-        it = typename Sequence::reverse_iterator(self->erase((++it).base()));
-        for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c)
-          it++;
-        delcount--;
-      }
     }
   }
 }
@@ -4701,6 +4546,16 @@ namespace swig
 }
 
 
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+#   define LLONG_MAX __LONG_LONG_MAX__
+#   define LLONG_MIN (-LLONG_MAX - 1LL)
+#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
 SWIGINTERN int
 SWIG_AsVal_int (PyObject * obj, int *val)
 {
@@ -4764,8 +4619,8 @@ namespace swig {
     static int asptr(PyObject *obj, sequence **seq) {
       if (obj == Py_None || SWIG_Python_GetSwigThis(obj)) {
 	sequence *p;
-	swig_type_info *descriptor = swig::type_info<sequence>();
-	if (descriptor && SWIG_IsOK(::SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0))) {
+	if (::SWIG_ConvertPtr(obj,(void**)&p,
+			      swig::type_info<sequence>(),0) == SWIG_OK) {
 	  if (seq) *seq = p;
 	  return SWIG_OLDOBJ;
 	}
@@ -4804,7 +4659,7 @@ namespace swig {
 #ifdef SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS
       swig_type_info *desc = swig::type_info<sequence>();
       if (desc && desc->clientdata) {
-	return SWIG_InternalNewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN);
+	return SWIG_NewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN);
       }
 #endif
       size_type size = seq.size();
@@ -4825,13 +4680,6 @@ namespace swig {
 
 
   namespace swig {
-    template <class T>
-    struct traits_reserve<std::vector<T> > {
-      static void reserve(std::vector<T> &seq, typename std::vector<T>::size_type n) {
-        seq.reserve(n);
-      }
-    };
-
     template <class T>
     struct traits_asptr<std::vector<T> >  {
       static int asptr(PyObject *obj, std::vector<T> **vec) {
@@ -4874,33 +4722,14 @@ SWIGINTERNINLINE PyObject*
 SWIG_From_unsigned_SS_long  (unsigned long value)
 {
   return (value > LONG_MAX) ?
-    PyLong_FromUnsignedLong(value) : PyInt_FromLong(static_cast< long >(value));
-}
-
-
-#ifdef SWIG_LONG_LONG_AVAILABLE
-SWIGINTERNINLINE PyObject* 
-SWIG_From_unsigned_SS_long_SS_long  (unsigned long long value)
-{
-  return (value > LONG_MAX) ?
-    PyLong_FromUnsignedLongLong(value) : PyInt_FromLong(static_cast< long >(value));
+    PyLong_FromUnsignedLong(value) : PyLong_FromLong(static_cast< long >(value)); 
 }
-#endif
 
 
 SWIGINTERNINLINE PyObject *
 SWIG_From_size_t  (size_t value)
 {    
-#ifdef SWIG_LONG_LONG_AVAILABLE
-  if (sizeof(size_t) <= sizeof(unsigned long)) {
-#endif
-    return SWIG_From_unsigned_SS_long  (static_cast< unsigned long >(value));
-#ifdef SWIG_LONG_LONG_AVAILABLE
-  } else {
-    /* assume sizeof(size_t) <= sizeof(unsigned long long) */
-    return SWIG_From_unsigned_SS_long_SS_long  (static_cast< unsigned long long >(value));
-  }
-#endif
+  return SWIG_From_unsigned_SS_long  (static_cast< unsigned long >(value));
 }
 
 SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg____getslice__(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j){
@@ -5000,18 +4829,13 @@ SWIGINTERN int
 SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
 {
 #if PY_VERSION_HEX>=0x03000000
-#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
-  if (PyBytes_Check(obj))
-#else
   if (PyUnicode_Check(obj))
-#endif
 #else  
   if (PyString_Check(obj))
 #endif
   {
     char *cstr; Py_ssize_t len;
 #if PY_VERSION_HEX>=0x03000000
-#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
     if (!alloc && cptr) {
         /* We can't allow converting without allocation, since the internal
            representation of string in Python 3 is UCS-2/UCS-4 but we require
@@ -5020,9 +4844,8 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
         return SWIG_RuntimeError;
     }
     obj = PyUnicode_AsUTF8String(obj);
-    if(alloc) *alloc = SWIG_NEWOBJ;
-#endif
     PyBytes_AsStringAndSize(obj, &cstr, &len);
+    if(alloc) *alloc = SWIG_NEWOBJ;
 #else
     PyString_AsStringAndSize(obj, &cstr, &len);
 #endif
@@ -5043,34 +4866,26 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
 	if (*alloc == SWIG_NEWOBJ) 
 #endif
 	{
-	  *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1)));
+	  *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1)));
 	  *alloc = SWIG_NEWOBJ;
 	} else {
 	  *cptr = cstr;
 	  *alloc = SWIG_OLDOBJ;
 	}
       } else {
-#if PY_VERSION_HEX>=0x03000000
-#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
-	*cptr = PyBytes_AsString(obj);
-#else
-	assert(0); /* Should never reach here with Unicode strings in Python 3 */
-#endif
-#else
+	#if PY_VERSION_HEX>=0x03000000
+	assert(0); /* Should never reach here in Python 3 */
+	#endif
 	*cptr = SWIG_Python_str_AsChar(obj);
-#endif
       }
     }
     if (psize) *psize = len + 1;
-#if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
+#if PY_VERSION_HEX>=0x03000000
     Py_XDECREF(obj);
 #endif
     return SWIG_OK;
   } else {
 #if defined(SWIG_PYTHON_2_UNICODE)
-#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
-#error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once"
-#endif
 #if PY_VERSION_HEX<0x03000000
     if (PyUnicode_Check(obj)) {
       char *cstr; Py_ssize_t len;
@@ -5081,7 +4896,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
       if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) {
         if (cptr) {
           if (alloc) *alloc = SWIG_NEWOBJ;
-          *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1)));
+          *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1)));
         }
         if (psize) *psize = len + 1;
 
@@ -5168,15 +4983,11 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
 	SWIG_InternalNewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void();
     } else {
 #if PY_VERSION_HEX >= 0x03000000
-#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
-      return PyBytes_FromStringAndSize(carray, static_cast< Py_ssize_t >(size));
-#else
 #if PY_VERSION_HEX >= 0x03010000
       return PyUnicode_DecodeUTF8(carray, static_cast< Py_ssize_t >(size), "surrogateescape");
 #else
       return PyUnicode_FromStringAndSize(carray, static_cast< Py_ssize_t >(size));
 #endif
-#endif
 #else
       return PyString_FromStringAndSize(carray, static_cast< Py_ssize_t >(size));
 #endif
@@ -6446,7 +6257,7 @@ fail:
 
 SWIGINTERN PyObject *SwigPyIterator_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
   SWIG_TypeNewClientData(SWIGTYPE_p_swig__SwigPyIterator, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
@@ -8364,7 +8175,7 @@ fail:
 
 SWIGINTERN PyObject *IntVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
   SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
@@ -10312,7 +10123,7 @@ fail:
 
 SWIGINTERN PyObject *StringVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
   SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
@@ -12230,7 +12041,7 @@ fail:
 
 SWIGINTERN PyObject *DoubleVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
   SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
@@ -14148,11 +13959,77 @@ fail:
 
 SWIGINTERN PyObject *UIntVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
   SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
 
+SWIGINTERN PyObject *STATUS_SIZE_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *module;
+  PyObject *d;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL;
+  d = PyModule_GetDict(module);
+  if (!d) return NULL;
+  SWIG_Python_SetConstant(d, "STATUS_SIZE",SWIG_From_int(static_cast< int >(64)));
+  return SWIG_Py_Void();
+}
+
+
+SWIGINTERN PyObject *SPECLEN_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *module;
+  PyObject *d;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL;
+  d = PyModule_GetDict(module);
+  if (!d) return NULL;
+  SWIG_Python_SetConstant(d, "SPECLEN",SWIG_From_int(static_cast< int >(8192)));
+  return SWIG_Py_Void();
+}
+
+
+SWIGINTERN PyObject *NOT_CONNECTED_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *module;
+  PyObject *d;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL;
+  d = PyModule_GetDict(module);
+  if (!d) return NULL;
+  SWIG_Python_SetConstant(d, "NOT_CONNECTED",SWIG_From_int(static_cast< int >(NOT_CONNECTED)));
+  return SWIG_Py_Void();
+}
+
+
+SWIGINTERN PyObject *ON_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *module;
+  PyObject *d;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL;
+  d = PyModule_GetDict(module);
+  if (!d) return NULL;
+  SWIG_Python_SetConstant(d, "ON",SWIG_From_int(static_cast< int >(ON)));
+  return SWIG_Py_Void();
+}
+
+
+SWIGINTERN PyObject *RECORDING_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *module;
+  PyObject *d;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL;
+  d = PyModule_GetDict(module);
+  if (!d) return NULL;
+  SWIG_Python_SetConstant(d, "RECORDING",SWIG_From_int(static_cast< int >(RECORDING)));
+  return SWIG_Py_Void();
+}
+
+
+SWIGINTERN PyObject *ERROR_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *module;
+  PyObject *d;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigconstant", &module)) return NULL;
+  d = PyModule_GetDict(module);
+  if (!d) return NULL;
+  SWIG_Python_SetConstant(d, "ERROR",SWIG_From_int(static_cast< int >(ERROR)));
+  return SWIG_Py_Void();
+}
+
+
 SWIGINTERN PyObject *_wrap_new_AmptekHardwareInterface(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   AmptekHardwareInterface *result = 0 ;
@@ -14827,13 +14704,88 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_AmptekHardwareInterface_startBuffering(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  AmptekHardwareInterface *arg1 = (AmptekHardwareInterface *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  bool result;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:AmptekHardwareInterface_startBuffering",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_AmptekHardwareInterface, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AmptekHardwareInterface_startBuffering" "', argument " "1"" of type '" "AmptekHardwareInterface *""'"); 
+  }
+  arg1 = reinterpret_cast< AmptekHardwareInterface * >(argp1);
+  result = (bool)(arg1)->startBuffering();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_AmptekHardwareInterface_stopBuffering(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  AmptekHardwareInterface *arg1 = (AmptekHardwareInterface *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  bool result;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:AmptekHardwareInterface_stopBuffering",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_AmptekHardwareInterface, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AmptekHardwareInterface_stopBuffering" "', argument " "1"" of type '" "AmptekHardwareInterface *""'"); 
+  }
+  arg1 = reinterpret_cast< AmptekHardwareInterface * >(argp1);
+  result = (bool)(arg1)->stopBuffering();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_AmptekHardwareInterface_GetBuffered(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  AmptekHardwareInterface *arg1 = (AmptekHardwareInterface *) 0 ;
+  size_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  size_t val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  std::vector< unsigned int,std::allocator< unsigned int > > result;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:AmptekHardwareInterface_GetBuffered",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_AmptekHardwareInterface, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AmptekHardwareInterface_GetBuffered" "', argument " "1"" of type '" "AmptekHardwareInterface *""'"); 
+  }
+  arg1 = reinterpret_cast< AmptekHardwareInterface * >(argp1);
+  ecode2 = SWIG_AsVal_size_t(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "AmptekHardwareInterface_GetBuffered" "', argument " "2"" of type '" "size_t""'");
+  } 
+  arg2 = static_cast< size_t >(val2);
+  result = (arg1)->GetBuffered(arg2);
+  resultobj = swig::from(static_cast< std::vector< unsigned int,std::allocator< unsigned int > > >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_AmptekHardwareInterface_StartCommtestStreaming(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   AmptekHardwareInterface *arg1 = (AmptekHardwareInterface *) 0 ;
   uint16_t arg2 ;
   uint16_t arg3 ;
   uint16_t arg4 ;
-  uint16_t arg5 ;
+  uint32_t arg5 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   unsigned short val2 ;
@@ -14842,7 +14794,7 @@ SWIGINTERN PyObject *_wrap_AmptekHardwareInterface_StartCommtestStreaming(PyObje
   int ecode3 = 0 ;
   unsigned short val4 ;
   int ecode4 = 0 ;
-  unsigned short val5 ;
+  unsigned int val5 ;
   int ecode5 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
@@ -14872,11 +14824,11 @@ SWIGINTERN PyObject *_wrap_AmptekHardwareInterface_StartCommtestStreaming(PyObje
     SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "AmptekHardwareInterface_StartCommtestStreaming" "', argument " "4"" of type '" "uint16_t""'");
   } 
   arg4 = static_cast< uint16_t >(val4);
-  ecode5 = SWIG_AsVal_unsigned_SS_short(obj4, &val5);
+  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
   if (!SWIG_IsOK(ecode5)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "AmptekHardwareInterface_StartCommtestStreaming" "', argument " "5"" of type '" "uint16_t""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "AmptekHardwareInterface_StartCommtestStreaming" "', argument " "5"" of type '" "uint32_t""'");
   } 
-  arg5 = static_cast< uint16_t >(val5);
+  arg5 = static_cast< uint32_t >(val5);
   result = (bool)(arg1)->StartCommtestStreaming(arg2,arg3,arg4,arg5);
   resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
@@ -17249,7 +17201,7 @@ fail:
 
 SWIGINTERN PyObject *AmptekHardwareInterface_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
-  if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
   SWIG_TypeNewClientData(SWIGTYPE_p_AmptekHardwareInterface, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
@@ -17410,6 +17362,12 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"UIntVector_capacity", _wrap_UIntVector_capacity, METH_VARARGS, NULL},
 	 { (char *)"delete_UIntVector", _wrap_delete_UIntVector, METH_VARARGS, NULL},
 	 { (char *)"UIntVector_swigregister", UIntVector_swigregister, METH_VARARGS, NULL},
+	 { (char *)"STATUS_SIZE_swigconstant", STATUS_SIZE_swigconstant, METH_VARARGS, NULL},
+	 { (char *)"SPECLEN_swigconstant", SPECLEN_swigconstant, METH_VARARGS, NULL},
+	 { (char *)"NOT_CONNECTED_swigconstant", NOT_CONNECTED_swigconstant, METH_VARARGS, NULL},
+	 { (char *)"ON_swigconstant", ON_swigconstant, METH_VARARGS, NULL},
+	 { (char *)"RECORDING_swigconstant", RECORDING_swigconstant, METH_VARARGS, NULL},
+	 { (char *)"ERROR_swigconstant", ERROR_swigconstant, METH_VARARGS, NULL},
 	 { (char *)"new_AmptekHardwareInterface", _wrap_new_AmptekHardwareInterface, METH_VARARGS, NULL},
 	 { (char *)"delete_AmptekHardwareInterface", _wrap_delete_AmptekHardwareInterface, METH_VARARGS, NULL},
 	 { (char *)"AmptekHardwareInterface_connectUSB", _wrap_AmptekHardwareInterface_connectUSB, METH_VARARGS, NULL},
@@ -17429,6 +17387,9 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"AmptekHardwareInterface_EnableListMode", _wrap_AmptekHardwareInterface_EnableListMode, METH_VARARGS, NULL},
 	 { (char *)"AmptekHardwareInterface_ResetListModeTimer", _wrap_AmptekHardwareInterface_ResetListModeTimer, METH_VARARGS, NULL},
 	 { (char *)"AmptekHardwareInterface_DisableListMode", _wrap_AmptekHardwareInterface_DisableListMode, METH_VARARGS, NULL},
+	 { (char *)"AmptekHardwareInterface_startBuffering", _wrap_AmptekHardwareInterface_startBuffering, METH_VARARGS, NULL},
+	 { (char *)"AmptekHardwareInterface_stopBuffering", _wrap_AmptekHardwareInterface_stopBuffering, METH_VARARGS, NULL},
+	 { (char *)"AmptekHardwareInterface_GetBuffered", _wrap_AmptekHardwareInterface_GetBuffered, METH_VARARGS, NULL},
 	 { (char *)"AmptekHardwareInterface_StartCommtestStreaming", _wrap_AmptekHardwareInterface_StartCommtestStreaming, METH_VARARGS, NULL},
 	 { (char *)"AmptekHardwareInterface_StopCommtestStreaming", _wrap_AmptekHardwareInterface_StopCommtestStreaming, METH_VARARGS, NULL},
 	 { (char *)"AmptekHardwareInterface_FastCount", _wrap_AmptekHardwareInterface_FastCount, METH_VARARGS, NULL},
@@ -17951,6 +17912,7 @@ extern "C" {
     static int type_init = 0;
     if (!type_init) {
       const PyTypeObject tmp = {
+        /* PyObject header changed in Python 3 */
 #if PY_VERSION_HEX >= 0x03000000
         PyVarObject_HEAD_INIT(NULL, 0)
 #else
@@ -18182,13 +18144,13 @@ SWIG_init(void) {
   static PyGetSetDef thisown_getset_def = {
     (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
   };
+  PyObject *metatype_args;
   PyTypeObject *builtin_pytype;
   int builtin_base_count;
   swig_type_info *builtin_basetype;
   PyObject *tuple;
   PyGetSetDescrObject *static_getset;
   PyTypeObject *metatype;
-  PyTypeObject *swigpyobject;
   SwigPyClientData *cd;
   PyObject *public_interface, *public_symbol;
   PyObject *this_descr;
@@ -18203,9 +18165,14 @@ SWIG_init(void) {
   (void)static_getset;
   (void)self;
   
-  /* Metaclass is used to implement static member variables */
-  metatype = SwigPyObjectType();
+  /* metatype is used to implement static member variables. */
+  metatype_args = Py_BuildValue("(s(O){})", "SwigPyObjectType", &PyType_Type);
+  assert(metatype_args);
+  metatype = (PyTypeObject *) PyType_Type.tp_call((PyObject *) &PyType_Type, metatype_args, NULL);
   assert(metatype);
+  Py_DECREF(metatype_args);
+  metatype->tp_setattro = (setattrofunc) &SwigPyObjectType_setattro;
+  assert(PyType_Ready(metatype) >= 0);
 #endif
   
   /* Fix SwigMethods to carry the callback ptrs when needed */
@@ -18223,15 +18190,13 @@ SWIG_init(void) {
   SWIG_InitializeModule(0);
   
 #ifdef SWIGPYTHON_BUILTIN
-  swigpyobject = SwigPyObject_TypeOnce();
-  
   SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject");
   assert(SwigPyObject_stype);
   cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
   if (!cd) {
     SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
-    SwigPyObject_clientdata.pytype = swigpyobject;
-  } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) {
+    SwigPyObject_clientdata.pytype = SwigPyObject_TypeOnce();
+  } else if (SwigPyObject_TypeOnce()->tp_basicsize != cd->pytype->tp_basicsize) {
     PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
 # if PY_VERSION_HEX >= 0x03000000
     return NULL;
@@ -18265,12 +18230,6 @@ SWIG_init(void) {
   
   import_array();
   
-  SWIG_Python_SetConstant(d, "STATUS_SIZE",SWIG_From_int(static_cast< int >(64)));
-  SWIG_Python_SetConstant(d, "SPECLEN",SWIG_From_int(static_cast< int >(8192)));
-  SWIG_Python_SetConstant(d, "NOT_CONNECTED",SWIG_From_int(static_cast< int >(NOT_CONNECTED)));
-  SWIG_Python_SetConstant(d, "ON",SWIG_From_int(static_cast< int >(ON)));
-  SWIG_Python_SetConstant(d, "RECORDING",SWIG_From_int(static_cast< int >(RECORDING)));
-  SWIG_Python_SetConstant(d, "ERROR",SWIG_From_int(static_cast< int >(ERROR)));
 #if PY_VERSION_HEX >= 0x03000000
   return m;
 #else
diff --git a/python/listdata_cdte.bin b/python/listdata_cdte.bin
new file mode 100644
index 0000000000000000000000000000000000000000..17820cb261db3399832f77320f90533df21218f3
Binary files /dev/null and b/python/listdata_cdte.bin differ
diff --git a/python/show_list_data.py b/python/show_list_data.py
new file mode 100644
index 0000000000000000000000000000000000000000..e0a99dfcc48d9276d520ee3a21bd1cbbf129c955
--- /dev/null
+++ b/python/show_list_data.py
@@ -0,0 +1,126 @@
+
+
+import sys 
+import struct 
+
+
+def read_records(f,datalength):
+    records = []
+    while(datalength >=4):
+        f1,ts = struct.unpack(">HH",f.read(4))
+        datalength -= 4
+        d1 = f1 >> 15
+        d2 = f1 >> 14
+        ampl = f1 & 0b11111111111111
+        record = {}
+        if d1 == 0: #event
+            record['type'] = 'event'
+            record['amplitude'] = ampl
+            record["ts_lower"] = ts 
+        elif d2 == 0: #32-bit timtag
+            record['type'] = 'timetag'
+            record["ts_lower"] = ts 
+            record["ts_upper"] = ampl
+        else: #frame = timetag
+            record['type'] = 'frame'
+            frame_count = (ampl << 2) + (ts >> 14)
+            ts_upper = ts & 0b11111111111111
+            record["ts_upper"] = ts_upper 
+            record["frame"] = frame_count
+        records.append(record)
+    return records
+
+def read_packet(f):
+    try:
+        pid1 = struct.unpack("B",f.read(1) )[0]
+        pid2 = struct.unpack("B",f.read(1) )[0]
+        datalength = struct.unpack(">H",f.read(2))[0]
+    except:
+        return None
+    packet = {}
+    if pid1 != 0x82:
+        return None
+    if pid2 == 0x0A:
+        packet["full"] = False 
+    elif pid2 == 0x0B:
+        packet["full"] = True
+    else:
+        return None 
+
+    if datalength == 0:
+        records = []
+    else:
+        records = read_records(f,datalength)
+    packet["records"] = records
+    return packet
+    
+
+
+with open( sys.argv[1] , "rb") as f:
+    data = []
+    amplitudes = []
+    packet_overflow_indices = []
+    packet_indices = []
+    records = []
+    i = 0
+    while(True):
+        packet = read_packet(f)
+        i += 1
+        if i == 1:
+            continue
+        
+        if packet is None:
+            break
+        if packet["full"]:
+            packet_overflow_indices.append(len(data))
+        else:
+            packet_indices.append(len(data))
+        
+        for record in packet["records"]:
+            records.append(record)
+            data.append( ["event","timetag", "frame"].index(record["type"]) )
+            if data[-1] == 0:
+                amplitudes.append( record["amplitude"] )
+
+import matplotlib.pyplot as plt 
+fig, ax = plt.subplots()
+ax.plot( data )
+for p in packet_indices:
+    ax.axvline(p, color = "tab:green")
+for p in packet_overflow_indices:
+    ax.axvline(p, color = "tab:red")
+
+print( sum( [1 for d in data if d == 0] ) )
+
+
+
+
+for i in range(1,len(records)):
+    record = records[i] 
+    last_record = records[i-1]
+    shared_keys = ["ts_upper", "frame"]
+    for shared_key in shared_keys:
+        if shared_key not in record:
+            if shared_key in last_record:
+                record[shared_key] = last_record[shared_key]
+
+    if "ts_upper" in record and "ts_lower" in record and "frame" in record :
+        record["full_ts"] = (record["ts_upper"] << 16) + record["ts_lower"]
+
+fig2, ax2 = plt.subplots() 
+event_records = [r for r in records if r["type"] == "event"]
+t = [ r["full_ts"] for r in event_records if "full_ts" in r ]
+a = [ r["amplitude"] for r in event_records if "full_ts" in r ]
+ax2.plot(t,a)
+
+fig3, ax3 = plt.subplots() 
+
+event_records = [r for r in records if r["type"] == "event"]
+t = [ r["full_ts"] for r in event_records if "full_ts" in r ]
+a = [ r["frame"] for r in event_records if "full_ts" in r ]
+ax3.plot(t,a)
+plt.show()
+
+
+
+
diff --git a/python/test.bin b/python/test.bin
new file mode 100644
index 0000000000000000000000000000000000000000..4e6712fd9aa049992bf11e517277358fce4ab4da
Binary files /dev/null and b/python/test.bin differ
diff --git a/src/AmptekHardwareInterface.cpp b/src/AmptekHardwareInterface.cpp
index 0693641aab21b5fa924464bba60ab9402ce08e8a..2d466248e54a91b427b4e47f24ff14b28f3391aa 100644
--- a/src/AmptekHardwareInterface.cpp
+++ b/src/AmptekHardwareInterface.cpp
@@ -20,6 +20,7 @@ AmptekHardwareInterface::~AmptekHardwareInterface(){
 }
 
 
+
 void AmptekHardwareInterface::connectUDP(std::string hostname, int port, double timeout){
 
     if (connection_handler != nullptr){
@@ -354,23 +355,135 @@ bool AmptekHardwareInterface::EnableListMode(std::string targetfile){
                     throw AmptekException("Response Packet is not of subtype LISTDATA: " + listResponse.toString());
                 }
                 //write the packet without the sync and checksum to file : [PID1,PID2,LEN_MSB;LEN_LSB,DATA_0,....,DATA_N]
-                streamfile.write( reinterpret_cast<char*>( &listResponse[PID1] ), listResponse.dataLength + 4 );
-
+                if (listResponse.dataLength > 0){
+                    streamfile.write( reinterpret_cast<char*>( &listResponse[PID1] ), listResponse.dataLength + 4 );
+                }
+                if (listResponse.dataLength < 1024){ // only sleep if not too many entries
+                    std::this_thread::sleep_for(std::chrono::microseconds(20));
+                }
             }
             catch(AmptekException& e){
                 std::cerr << e.what() << std::endl;
             }
-            std::this_thread::sleep_for(std::chrono::microseconds(100));
+            
         }
     });
     return true;
 }
 
+
+bool AmptekHardwareInterface::startBuffering(){
+    try{
+        expectAcknowledge(connection_handler->sendAndReceive( Packet::DP5_PKT_REQUEST_RESTART_SEQ_BUFFERING) );
+    }
+    catch(AmptekException& e){
+    
+            std::cerr<< "Failed clearing list-mode timer: " << e.what() << std::endl;
+            return false;
+    }
+}
+bool AmptekHardwareInterface::stopBuffering(){
+    try{
+        expectAcknowledge(connection_handler->sendAndReceive( Packet::DP5_PKT_REQUEST_CANCEL_SEQ_BUFFERING) );
+    }
+    catch(AmptekException& e){
+    
+            std::cerr<< "Failed clearing list-mode timer: " << e.what() << std::endl;
+            return false;
+    }
+}
+std::vector<unsigned int> AmptekHardwareInterface::GetBuffered(size_t id){
+    Packet spectrumResponse = connection_handler->sendAndReceive( Packet::generateGetBufferRequest(id) );
+    
+    //std::cout << spectrumResponse.size() << std::endl;
+    if (spectrumResponse.at(PID1) != DP5_P1_SPECTRUM_RESPONSE )
+    {
+            std::cerr<< "Response Packet is not of type Spectrum: " << spectrumResponse.toString() << std::endl;
+            return std::vector<unsigned int>();
+    }
+    bool with_status = true;
+    switch( spectrumResponse.at(PID2) ){
+        case DP5_P2_SPECTRUM_RESPONSE_SPECTRUM256:
+            with_status = false;        // not break! use the respose with status setting the length
+        case DP5_P2_SPECTRUM_RESPONSE_SPECTRUM256_STATUS:
+            spectrum_length=256;
+            break;
+
+        case DP5_P2_SPECTRUM_RESPONSE_SPECTRUM512:
+            with_status = false;        // not break! use the respose with status setting the length
+        case DP5_P2_SPECTRUM_RESPONSE_SPECTRUM512_STATUS:
+            spectrum_length=512;
+            break;
+
+        case DP5_P2_SPECTRUM_RESPONSE_SPECTRUM1024:
+            with_status = false;        // not break! use the respose with status setting the length
+        case DP5_P2_SPECTRUM_RESPONSE_SPECTRUM1024_STATUS:
+            spectrum_length=1024;
+            break;
+
+        case DP5_P2_SPECTRUM_RESPONSE_SPECTRUM2048:
+            with_status = false;        // not break! use the respose with status setting the length
+        case DP5_P2_SPECTRUM_RESPONSE_SPECTRUM2048_STATUS:
+            spectrum_length=2048;
+            break;
+
+        case DP5_P2_SPECTRUM_RESPONSE_SPECTRUM4096:
+            with_status = false;        // not break! use the respose with status setting the length
+        case DP5_P2_SPECTRUM_RESPONSE_SPECTRUM4096_STATUS:
+            spectrum_length=4096;
+            break;
+
+        
+        case DP5_P2_SPECTRUM_RESPONSE_SPECTRUM8192:
+            with_status = false;        // not break! use the respose with status setting the length
+        case DP5_P2_SPECTRUM_RESPONSE_SPECTRUM8192_STATUS:
+            spectrum_length=8192;
+            break;
+    }
+    
+    int spectrum_bytesize = 3*spectrum_length;
+    try{
+        for (int i = 0; i < spectrum_length; ++i){
+            last_spectrum[i] = mergeBytes( spectrumResponse.at(DATA + 3*i + 2),
+                                        spectrumResponse.at(DATA + 3*i + 1),
+                                        spectrumResponse.at(DATA + 3*i    )
+                                        );
+        }
+    }
+    catch(std::runtime_error& e){
+        throw AmptekException(std::string("Failed in AmptekHardwareInterface::updateSpectrum \
+                                during spectrum update: ") + e.what());
+    }
+
+    try{
+        last_spectrum_update_time = std::chrono::system_clock::now();
+        if (with_status){
+            memcpy(last_status,&(spectrumResponse.at(DATA + spectrum_bytesize)), spectrumResponse.dataLength - spectrum_bytesize );
+            last_status_update_time = last_spectrum_update_time;
+        }
+    }
+    catch(std::runtime_error& e){
+        throw AmptekException(std::string("Failed in AmptekHardwareInterface::updateSpectrum \
+                                during status update: ") + e.what());
+    }
+    
+    
+    std::vector<unsigned int> spec( last_spectrum, last_spectrum + spectrum_length );
+	return spec;
+}
+
+
+
 bool AmptekHardwareInterface::DisableListMode(){
     listmode_flag = false;
-    list_reader_thread->join();
-    streamfile.close();
-    delete list_reader_thread;
+    if (list_reader_thread != nullptr ){
+        list_reader_thread->join();
+        streamfile.close();
+        delete list_reader_thread;
+        list_reader_thread = nullptr;
+        return true;
+    }
+    return false;
 }
 
 bool AmptekHardwareInterface::ResetListModeTimer(){
@@ -387,19 +500,22 @@ bool AmptekHardwareInterface::ResetListModeTimer(){
 
 
 bool AmptekHardwareInterface::StartCommtestStreaming(uint16_t min_channel,uint16_t max_channel, 
-                                    uint16_t increment, uint16_t rate)
+                                    uint16_t increment, uint32_t rate)
 {
     // convert from rate (cts/sec) to number of fpga clock cycles between two events
-    uint32_t period = std::max(8., 1./( rate * FpgaClock()*1e-9 ) );
+    uint32_t period = std::max(8., FpgaClock()*1e6/rate );
+    std::cout << "Pulse Period: " << period << std::endl;
     try{
         Packet commtest_packet = Packet::generateCommtestStreamingRequest(min_channel, max_channel, increment, period);
-        expectAcknowledge(connection_handler->sendAndReceive( Packet::DP5_PKT_REQUEST_STOP_STREAM_COMMTEST) );
+        std::cout << commtest_packet.toString() << std::endl;
+        expectAcknowledge(connection_handler->sendAndReceive( commtest_packet) );
     }
     catch(AmptekException& e){
     
             std::cerr<< "Failed stopping comm test: " << e.what() << std::endl;
             return false;
     }
+    return true;
 }
 bool AmptekHardwareInterface::StopCommtestStreaming(){
     try{
@@ -410,6 +526,7 @@ bool AmptekHardwareInterface::StopCommtestStreaming(){
             std::cerr<< "Failed stopping comm test: " << e.what() << std::endl;
             return false;
     }
+    return true;
 }
 
 
diff --git a/src/packet.cpp b/src/packet.cpp
index 4a0964daa3057acd9901bc0bbabaef5648b45bc6..dadd8e5898d1831b538bf1582c7382581226e288 100644
--- a/src/packet.cpp
+++ b/src/packet.cpp
@@ -59,13 +59,13 @@ const Packet Packet::generateCommtestStreamingRequest(uint16_t min_channel,uint1
 {
     byte data[8];
     data[0] = min_channel >> 8;
-    data[1] = min_channel;
+    data[1] = min_channel & 0xFF;
     data[2] = max_channel >> 8;
-    data[3] = max_channel;
+    data[3] = max_channel & 0xFF;
     data[4] = increment >> 8;
-    data[5] = increment;
+    data[5] = increment & 0xFF;
     data[6] = period >> 8;
-    data[7] = period;
+    data[7] = period & 0xFF;
     return Packet( DP5_P1_COMMTEST_REQUEST    , DP5_P2_COMMTEST_REQUEST_STREAM , data, 8 );
 
 }