diff --git a/python/amptek_hardware_interface/AmptekHardwareInterface.i b/python/amptek_hardware_interface/AmptekHardwareInterface.i
index a7dd418adfd080e8a228251b605830e37acb65db..404c2d8ce873518a01765a4339f8967e974fd446 100644
--- a/python/amptek_hardware_interface/AmptekHardwareInterface.i
+++ b/python/amptek_hardware_interface/AmptekHardwareInterface.i
@@ -10,6 +10,8 @@
 %init %{
     import_array();
 %}
+%naturalvar AmptekSpectrum::bins;
+
 %numpy_typemaps(unsigned int      , NPY_UINT     , int)
 
 %include "stdint.i"
diff --git a/python/amptek_hardware_interface/AmptekHardwareInterface_wrap.cpp b/python/amptek_hardware_interface/AmptekHardwareInterface_wrap.cpp
index b8a4bf1fcc4c3f1642634c925cee73b1cea98a62..d6a9357e2d51d6939611ef28b11853dac2e91dca 100644
--- a/python/amptek_hardware_interface/AmptekHardwareInterface_wrap.cpp
+++ b/python/amptek_hardware_interface/AmptekHardwareInterface_wrap.cpp
@@ -16173,11 +16173,10 @@ SWIGINTERN PyObject *AmptekStatus_swigregister(PyObject *SWIGUNUSEDPARM(self), P
 SWIGINTERN PyObject *_wrap_AmptekSpectrum_bins_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   AmptekSpectrum *arg1 = (AmptekSpectrum *) 0 ;
-  std::vector< unsigned int,std::allocator< unsigned int > > *arg2 = (std::vector< unsigned int,std::allocator< unsigned int > > *) 0 ;
+  std::vector< unsigned int,std::allocator< unsigned int > > *arg2 = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
+  int res2 = SWIG_OLDOBJ ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   
@@ -16187,15 +16186,23 @@ SWIGINTERN PyObject *_wrap_AmptekSpectrum_bins_set(PyObject *SWIGUNUSEDPARM(self
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AmptekSpectrum_bins_set" "', argument " "1"" of type '" "AmptekSpectrum *""'"); 
   }
   arg1 = reinterpret_cast< AmptekSpectrum * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "AmptekSpectrum_bins_set" "', argument " "2"" of type '" "std::vector< unsigned int,std::allocator< unsigned int > > *""'"); 
+  {
+    std::vector< unsigned int,std::allocator< unsigned int > > *ptr = (std::vector< unsigned int,std::allocator< unsigned int > > *)0;
+    res2 = swig::asptr(obj1, &ptr);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "AmptekSpectrum_bins_set" "', argument " "2"" of type '" "std::vector< unsigned int,std::allocator< unsigned int > > const &""'"); 
+    }
+    if (!ptr) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "AmptekSpectrum_bins_set" "', argument " "2"" of type '" "std::vector< unsigned int,std::allocator< unsigned int > > const &""'"); 
+    }
+    arg2 = ptr;
   }
-  arg2 = reinterpret_cast< std::vector< unsigned int,std::allocator< unsigned int > > * >(argp2);
   if (arg1) (arg1)->bins = *arg2;
   resultobj = SWIG_Py_Void();
+  if (SWIG_IsNewObj(res2)) delete arg2;
   return resultobj;
 fail:
+  if (SWIG_IsNewObj(res2)) delete arg2;
   return NULL;
 }
 
@@ -16214,8 +16221,8 @@ SWIGINTERN PyObject *_wrap_AmptekSpectrum_bins_get(PyObject *SWIGUNUSEDPARM(self
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AmptekSpectrum_bins_get" "', argument " "1"" of type '" "AmptekSpectrum *""'"); 
   }
   arg1 = reinterpret_cast< AmptekSpectrum * >(argp1);
-  result = (std::vector< unsigned int,std::allocator< unsigned int > > *)& ((arg1)->bins);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 |  0 );
+  result = (std::vector< unsigned int,std::allocator< unsigned int > > *) & ((arg1)->bins);
+  resultobj = swig::from(static_cast< std::vector< unsigned int,std::allocator< unsigned int > > >(*result));
   return resultobj;
 fail:
   return NULL;
diff --git a/python/amptek_hardware_interface/AmptekPX5 b/python/amptek_hardware_interface/AmptekPX5
index 7bb022d6e9f507b90b34848326fdf8883f42ea1f..4e8cfd959bf4398b1978821308eb4bb6f556fca7 100644
--- a/python/amptek_hardware_interface/AmptekPX5
+++ b/python/amptek_hardware_interface/AmptekPX5
@@ -1,4 +1,10 @@
 #!/usr/bin/env python3
+import logging 
+
+logging.basicConfig(
+    format='%(asctime)s %(levelname)-8s %(message)s',
+    level=logging.DEBUG,
+    datefmt='%Y-%m-%d %H:%M:%S')
 
 from tango import AttrQuality, AttrWriteType, DispLevel, DevState, DebugIt
 from tango.server import Device, attribute, command, pipe, device_property
@@ -447,6 +453,7 @@ class AmptekPX5(Device):
 
     @command(dtype_in=str)
     def SaveSpectrumAsMCA(self, filepath):
+        
         if os.path.exists(filepath):
             self.set_state(tango.DevState.ALARM)
             raise RuntimeError("File already exists!")   
@@ -464,8 +471,10 @@ class AmptekPX5(Device):
 
     @command(dtype_in=(str,) )
     def SaveBufferedSpectrumAsMCA(self, args):
+        logging.debug("SaveBufferedSpectrumAsMCA called")
         buffer_index, filepath = args
         buffer_index= int(buffer_index)
+        logging.debug("Buffer Index %d, Target File: %s"%(buffer_index, filepath))
         if os.path.exists(filepath):
             self.set_state(tango.DevState.ALARM)
             raise RuntimeError("File already exists!")   
@@ -473,14 +482,22 @@ class AmptekPX5(Device):
             self.set_state(tango.DevState.ALARM)
             raise RuntimeError("Directory %s does not exist (filename: %s)!"%(os.path.dirname(filepath), filepath) )   
 
+        logging.debug("get buffered spectrum")
         spectrum, status = self.interface.GetBufferedSpectrum( buffer_index )
-
+        spectrum = spectrum.bins
+        logging.debug(status.SlowCount() )
         with open(filepath, "w+") as f:
+            logging.debug("call create_pmca_spectrum_string")
             f.write( self.create_pmca_spectrum_string() )
+            logging.debug("call create_calibration_string")
             f.write( self.create_calibration_string() )
-            f.write( self.create_data_string() )
+            logging.debug("call create_data_string")
+            f.write( self.create_data_string(spectrum=spectrum) )
+            logging.debug("call create_dp5_config_string")
             f.write( self.create_dp5_config_string() )
-            f.write( self.create_dpp_status_string() )
+            logging.debug("call create_dpp_status_string")
+            f.write( self.create_dpp_status_string(status=status) )
+        logging.debug("finished SaveBufferedSpectrumAsMCA")
 
     @command(dtype_in=(int,))
     def StartCommtestStreaming(self, args):
@@ -505,6 +522,7 @@ class AmptekPX5(Device):
     @command(dtype_in = int)
     def BufferAndClearSpectrum(self, index):
         self.interface.BufferAndClearSpectrum(index)
+        self.ClearSpectrum()
 
 
 
diff --git a/src/AmptekHardwareInterface.cpp b/src/AmptekHardwareInterface.cpp
index 6776e66dc7f21eb22f4eca22280e606de4b74d65..cd486e3effd2ef3e965433ad206b8f1661ebdde1 100644
--- a/src/AmptekHardwareInterface.cpp
+++ b/src/AmptekHardwareInterface.cpp
@@ -661,6 +661,7 @@ std::pair<AmptekSpectrum, AmptekStatus>  AmptekHardwareInterface::GetBufferedSpe
     int spectrum_bytesize = 3*spectrum_length;
     AmptekSpectrum buffered_spectrum( &(spectrumResponse.at(DATA) ), spectrum_length );
     AmptekStatus buffered_status(&(spectrumResponse.at(DATA + spectrum_bytesize)));
+    std:cout << buffered_status.SlowCount() << std::endl;
     return  std::pair<AmptekSpectrum, AmptekStatus>( buffered_spectrum, buffered_status );
 }