Merge pull request #203 from ptrkrysik/development

Development
diff --git a/.gitignore b/.gitignore
index 321fa74..99dd781 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,5 @@
 *.pyo
 .unittests
 build/
+debian/tmp/
+debian/files
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 551b982..0c84262 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,7 @@
 env:
   #- DOCKERFILE=tests/dockerfiles/Debian_Jessie.docker IMGNAME=debjess-grgsm
   #- DOCKERFILE=tests/dockerfiles/Ubuntu_15_04.docker IMGNAME=ubu15.04-grgsm
-  - DOCKERFILE=tests/dockerfiles/Debian_testing.docker IMGNAME=debtest-grgsm
+  #- DOCKERFILE=tests/dockerfiles/Debian_testing.docker IMGNAME=debtest-grgsm
   - DOCKERFILE=tests/dockerfiles/Ubuntu_16_04.docker IMGNAME=ubu16.04-grgsm
 
 services:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00c37dd..5832d42 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,6 +72,8 @@
     if("${SWIG_VERSION}" VERSION_GREATER "1.3.30")
         set(SWIG_VERSION_CHECK TRUE)
     endif()
+else()
+    message(FATAL_ERROR "SWIG required to compile gr-gsm")
 endif(SWIG_FOUND)
 
 
@@ -99,7 +101,7 @@
 ########################################################################
 # Find gnuradio build dependencies
 ########################################################################
-set(GR_REQUIRED_COMPONENTS RUNTIME PMT)
+set(GR_REQUIRED_COMPONENTS RUNTIME FILTER PMT)
 find_package(Gnuradio)
 find_package(Volk)
 find_package(CppUnit)
@@ -138,14 +140,14 @@
     ${CMAKE_BINARY_DIR}/include
     ${Boost_INCLUDE_DIRS}
     ${CPPUNIT_INCLUDE_DIRS}
-    ${GNURADIO_RUNTIME_INCLUDE_DIRS}
+    ${GNURADIO_ALL_INCLUDE_DIRS}
     ${LIBOSMOCORE_INCLUDE_DIR}
 )
 
 link_directories(
     ${Boost_LIBRARY_DIRS}
     ${CPPUNIT_LIBRARY_DIRS}
-    ${GNURADIO_RUNTIME_LIBRARY_DIRS}
+    ${GNURADIO_ALL_LIBRARY_DIRS}
 )
 
 # Set component parameters
diff --git a/PACKAGING.md b/PACKAGING.md
deleted file mode 100644
index 75914db..0000000
--- a/PACKAGING.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# Packaging gr-gsm
-## This is a work in progress...
-
-* Run the build.sh script!
diff --git a/README.md b/README.md
index c8ab407..bcd359f 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@
 
 Development
 ===========
-New features are accepted through github's pull requests. When creating pull request try to make it adress one topic (addition of a feature x, corretion of bug y).
+New features are accepted through github's pull requests. When creating pull request try to make it adress one topic (addition of a feature x, correction of bug y).
 
 If you wish to develop something for gr-gsm but don't know exactly what, then look for issues with label "Enhancement". Select one that you feel you are able to complete. After that claim it by commenting in the comment section of the issue. If there is any additional information about gr-gsm needed by you to make completing the task easier - just ask.
 
diff --git a/apps/grgsm_decode b/apps/grgsm_decode
index cc2a55d..968c1da 100755
--- a/apps/grgsm_decode
+++ b/apps/grgsm_decode
@@ -74,7 +74,7 @@
             self.receiver = grgsm.receiver(4, ([0]), ([]))
             if self.fc is not None:
                 self.input_adapter = grgsm.gsm_input(ppm=0, osr=4, fc=self.fc, samp_rate_in=samp_rate)
-                self.offset_control = grgsm.clock_offset_control(self.fc)
+                self.offset_control = grgsm.clock_offset_control(self.fc, self.samp_rate)
             else:
                 self.input_adapter = grgsm.gsm_input(ppm=0, osr=4, samp_rate_in=samp_rate)
 
@@ -126,7 +126,7 @@
             self.connect((self.file_source, 0), (self.input_adapter, 0))
             self.connect((self.input_adapter, 0), (self.receiver, 0))
             if self.fc is not None:
-                self.msg_connect(self.offset_control, "ppm", self.input_adapter, "ppm_in")
+                self.msg_connect(self.offset_control, "ctrl", self.input_adapter, "ctrl_in")
                 self.msg_connect(self.receiver, "measurements", self.offset_control, "measurements")
             self.msg_connect(self.receiver, "C0", self.dummy_burst_filter, "in")
 
diff --git a/apps/grgsm_livemon b/apps/grgsm_livemon
index 1d37970..cb5b55c 100755
--- a/apps/grgsm_livemon
+++ b/apps/grgsm_livemon
@@ -1,8 +1,11 @@
 #!/usr/bin/env python2
+# -*- coding: utf-8 -*-
 ##################################################
 # GNU Radio Python Flow Graph
 # Title: Gr-gsm Livemon
-# Generated: Wed Sep  2 21:46:35 2015
+# Author: Piotr Krysik
+# Description: Interactive monitor of a single C0 channel with analysis performed by Wireshark (command to run wireshark: sudo wireshark -k -f udp -Y gsmtap -i lo)
+# Generated: Fri Jul 15 13:18:50 2016
 ##################################################
 
 if __name__ == '__main__':
@@ -35,14 +38,14 @@
 
 class grgsm_livemon(gr.top_block, Qt.QWidget):
 
-    def __init__(self, fc=939.4e6, gain=30, ppm=0, samp_rate=2000000.052982, shiftoff=400e3, args=""):
+    def __init__(self, args="", fc=939.4e6, gain=30, ppm=0, samp_rate=2000000.052982, shiftoff=400e3):
         gr.top_block.__init__(self, "Gr-gsm Livemon")
         Qt.QWidget.__init__(self)
         self.setWindowTitle("Gr-gsm Livemon")
         try:
-             self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
+            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
         except:
-             pass
+            pass
         self.top_scroll_layout = Qt.QVBoxLayout()
         self.setLayout(self.top_scroll_layout)
         self.top_scroll = Qt.QScrollArea()
@@ -61,6 +64,7 @@
         ##################################################
         # Parameters
         ##################################################
+        self.args = args
         self.fc = fc
         self.gain = gain
         self.ppm = ppm
@@ -109,40 +113,43 @@
         )
         self.qtgui_freq_sink_x_0.set_update_time(0.10)
         self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
-#        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
-#        self.qtgui_freq_sink_x_0.enable_autoscale(False)
-#        self.qtgui_freq_sink_x_0.enable_grid(False)
-#        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
-#        self.qtgui_freq_sink_x_0.enable_control_panel(False)
-#        
-#        if not True:
-#          self.qtgui_freq_sink_x_0.disable_legend()
-#        
-#        if complex == type(float()):
-#          self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)
-#        
-#        labels = ["", "", "", "", "",
-#                  "", "", "", "", ""]
-#        widths = [1, 1, 1, 1, 1,
-#                  1, 1, 1, 1, 1]
-#        colors = ["blue", "red", "green", "black", "cyan",
-#                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
-#        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
-#                  1.0, 1.0, 1.0, 1.0, 1.0]
-#        for i in xrange(1):
-#            if len(labels[i]) == 0:
-#                self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i))
-#            else:
-#                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
-#            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
-#            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
-#            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])
+        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
+        self.qtgui_freq_sink_x_0.enable_autoscale(False)
+        self.qtgui_freq_sink_x_0.enable_grid(False)
+        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
+        self.qtgui_freq_sink_x_0.enable_control_panel(False)
+        
+        if not True:
+          self.qtgui_freq_sink_x_0.disable_legend()
+        
+        if "complex" == "float" or "complex" == "msg_float":
+          self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)
+        
+        labels = ["", "", "", "", "",
+                  "", "", "", "", ""]
+        widths = [1, 1, 1, 1, 1,
+                  1, 1, 1, 1, 1]
+        colors = ["blue", "red", "green", "black", "cyan",
+                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
+        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
+                  1.0, 1.0, 1.0, 1.0, 1.0]
+        for i in xrange(1):
+            if len(labels[i]) == 0:
+                self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i))
+            else:
+                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
+            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
+            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
+            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])
         
         self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
         self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)
-        self.gsm_sdcch8_demapper_0 = grgsm.gsm_sdcch8_demapper(1)
-        self.gsm_receiver_0 = grgsm.receiver(4, ([0]), ([]))
-        self.gsm_message_printer_1 = grgsm.message_printer(pmt.intern(""), False)
+        self.gsm_sdcch8_demapper_0 = grgsm.gsm_sdcch8_demapper(
+            timeslot_nr=1,
+        )
+        self.gsm_receiver_0 = grgsm.receiver(4, ([0]), ([]), False)
+        self.gsm_message_printer_1 = grgsm.message_printer(pmt.intern(""), False,
+            False, False)
         self.gsm_input_0 = grgsm.gsm_input(
             ppm=0,
             osr=4,
@@ -152,17 +159,19 @@
         self.gsm_decryption_0 = grgsm.decryption(([]), 1)
         self.gsm_control_channels_decoder_0_0 = grgsm.control_channels_decoder()
         self.gsm_control_channels_decoder_0 = grgsm.control_channels_decoder()
-        self.gsm_clock_offset_control_0 = grgsm.clock_offset_control(fc-shiftoff)
-        self.gsm_bcch_ccch_demapper_0 = grgsm.gsm_bcch_ccch_demapper(0)
-        self.blocks_socket_pdu_0_0 = blocks.socket_pdu("UDP_SERVER", "127.0.0.1", "4729", 10000)
-        self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_CLIENT", "127.0.0.1", "4729", 10000)
+        self.gsm_clock_offset_control_0 = grgsm.clock_offset_control(fc-shiftoff, samp_rate)
+        self.gsm_bcch_ccch_demapper_0 = grgsm.gsm_bcch_ccch_demapper(
+            timeslot_nr=0,
+        )
+        self.blocks_socket_pdu_0_0 = blocks.socket_pdu("UDP_SERVER", "127.0.0.1", "4729", 10000, False)
+        self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_CLIENT", "127.0.0.1", "4729", 10000, False)
         self.blocks_rotator_cc_0 = blocks.rotator_cc(-2*pi*shiftoff/samp_rate)
 
         ##################################################
         # Connections
         ##################################################
         self.msg_connect((self.gsm_bcch_ccch_demapper_0, 'bursts'), (self.gsm_control_channels_decoder_0, 'bursts'))    
-        self.msg_connect((self.gsm_clock_offset_control_0, 'ppm'), (self.gsm_input_0, 'ppm_in'))    
+        self.msg_connect((self.gsm_clock_offset_control_0, 'ctrl'), (self.gsm_input_0, 'ctrl_in'))    
         self.msg_connect((self.gsm_control_channels_decoder_0, 'msgs'), (self.blocks_socket_pdu_0, 'pdus'))    
         self.msg_connect((self.gsm_control_channels_decoder_0, 'msgs'), (self.gsm_message_printer_1, 'msgs'))    
         self.msg_connect((self.gsm_control_channels_decoder_0_0, 'msgs'), (self.blocks_socket_pdu_0, 'pdus'))    
@@ -182,6 +191,13 @@
         self.settings.setValue("geometry", self.saveGeometry())
         event.accept()
 
+
+    def get_args(self):
+        return self.args
+
+    def set_args(self, args):
+        self.args = args
+
     def get_fc(self):
         return self.fc
 
@@ -210,9 +226,9 @@
     def set_samp_rate(self, samp_rate):
         self.samp_rate = samp_rate
         self.blocks_rotator_cc_0.set_phase_inc(-2*pi*self.shiftoff/self.samp_rate)
-        self.gsm_input_0.set_samp_rate_in(self.samp_rate)
         self.qtgui_freq_sink_x_0.set_frequency_range(self.fc_slider, self.samp_rate)
         self.rtlsdr_source_0.set_sample_rate(self.samp_rate)
+        self.gsm_input_0.set_samp_rate_in(self.samp_rate)
 
     def get_shiftoff(self):
         return self.shiftoff
@@ -246,28 +262,40 @@
         self.rtlsdr_source_0.set_center_freq(self.fc_slider-self.shiftoff, 0)
 
 
-if __name__ == '__main__':
+def argument_parser():
     parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
-    parser.add_option("-f", "--fc", dest="fc", type="eng_float", default=eng_notation.num_to_str(939.4e6),
+    parser.add_option(
+        "", "--args", dest="args", type="string", default="",
+        help="Set Device Arguments [default=%default]")
+    parser.add_option(
+        "-f", "--fc", dest="fc", type="eng_float", default=eng_notation.num_to_str(939.4e6),
         help="Set fc [default=%default]")
-    parser.add_option("-g", "--gain", dest="gain", type="eng_float", default=eng_notation.num_to_str(30),
+    parser.add_option(
+        "-g", "--gain", dest="gain", type="eng_float", default=eng_notation.num_to_str(30),
         help="Set gain [default=%default]")
-    parser.add_option("-p", "--ppm", dest="ppm", type="intx", default=0,
+    parser.add_option(
+        "-p", "--ppm", dest="ppm", type="intx", default=0,
         help="Set ppm [default=%default]")
-    parser.add_option("-s", "--samp-rate", dest="samp_rate", type="eng_float", default=eng_notation.num_to_str(2000000.052982),
+    parser.add_option(
+        "-s", "--samp-rate", dest="samp_rate", type="eng_float", default=eng_notation.num_to_str(2000000.052982),
         help="Set samp_rate [default=%default]")
-    parser.add_option("-o", "--shiftoff", dest="shiftoff", type="eng_float", default=eng_notation.num_to_str(400e3),
+    parser.add_option(
+        "-o", "--shiftoff", dest="shiftoff", type="eng_float", default=eng_notation.num_to_str(400e3),
         help="Set shiftoff [default=%default]")
-    parser.add_option("", "--args", dest="args", type="string", default="",
-        help="Set device arguments [default=%default]")
-                
-    (options, args) = parser.parse_args()
-#    from distutils.version import StrictVersion
-#    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
-#        Qt.QApplication.setGraphicsSystem(gr.prefs().get_string('qtgui','style','raster'))
-    Qt.QApplication.setGraphicsSystem(gr.prefs().get_string('qtgui','style','raster'))
+    return parser
+
+
+def main(top_block_cls=grgsm_livemon, options=None):
+    if options is None:
+        options, _ = argument_parser().parse_args()
+
+    from distutils.version import StrictVersion
+    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
+        style = gr.prefs().get_string('qtgui', 'style', 'raster')
+        Qt.QApplication.setGraphicsSystem(style)
     qapp = Qt.QApplication(sys.argv)
-    tb = grgsm_livemon(fc=options.fc, gain=options.gain, ppm=options.ppm, samp_rate=options.samp_rate, shiftoff=options.shiftoff, args=options.args)
+
+    tb = top_block_cls(args=options.args, fc=options.fc, gain=options.gain, ppm=options.ppm, samp_rate=options.samp_rate, shiftoff=options.shiftoff)
     tb.start()
     tb.show()
 
@@ -276,4 +304,7 @@
         tb.wait()
     qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
     qapp.exec_()
-    tb = None  # to clean up Qt widgets
+
+
+if __name__ == '__main__':
+    main()
diff --git a/apps/grgsm_livemon.grc b/apps/grgsm_livemon.grc
index 22c30b0..9c3945d 100644
--- a/apps/grgsm_livemon.grc
+++ b/apps/grgsm_livemon.grc
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='utf-8'?>
-<?grc format='1' created='3.7.8'?>
+<?grc format='1' created='3.7.9'?>
 <flow_graph>
   <timestamp>Sat Dec 13 10:49:59 2014</timestamp>
   <block>
@@ -9,10 +9,6 @@
       <value>Piotr Krysik</value>
     </param>
     <param>
-      <key>alias</key>
-      <value></value>
-    </param>
-    <param>
       <key>window_size</key>
       <value>2280, 1024</value>
     </param>
@@ -45,6 +41,10 @@
       <value>qt_gui</value>
     </param>
     <param>
+      <key>hier_block_src_path</key>
+      <value>.:</value>
+    </param>
+    <param>
       <key>id</key>
       <value>grgsm_livemon</value>
     </param>
@@ -53,10 +53,18 @@
       <value>0</value>
     </param>
     <param>
+      <key>qt_qss_theme</key>
+      <value></value>
+    </param>
+    <param>
       <key>realtime_scheduling</key>
       <value></value>
     </param>
     <param>
+      <key>run_command</key>
+      <value>{python} -u {filename}</value>
+    </param>
+    <param>
       <key>run_options</key>
       <value>prompt</value>
     </param>
@@ -594,14 +602,6 @@
       <key>timeslot_nr</key>
       <value>0</value>
     </param>
-    <param>
-      <key>channel_types</key>
-      <value>[1,2,2,2,2,2,2,2,2,2]</value>
-    </param>
-    <param>
-      <key>starts_fn_mod51</key>
-      <value>[2,6,12,16,22,26,32,36,42,46]</value>
-    </param>
   </block>
   <block>
     <key>gsm_clock_offset_control</key>
@@ -645,6 +645,10 @@
       <key>fc</key>
       <value>fc-shiftoff</value>
     </param>
+    <param>
+      <key>samp_rate</key>
+      <value>samp_rate</value>
+    </param>
   </block>
   <block>
     <key>gsm_control_channels_decoder</key>
@@ -970,14 +974,6 @@
       <key>timeslot_nr</key>
       <value>1</value>
     </param>
-    <param>
-      <key>channel_types</key>
-      <value>[8,8,8,8,8,8,8,8,136,136,136,136]</value>
-    </param>
-    <param>
-      <key>starts_fn_mod51</key>
-      <value>[0,4,8,12,16,20,24,28,32,36,40,44]</value>
-    </param>
   </block>
   <block>
     <key>import</key>
@@ -2854,8 +2850,8 @@
   <connection>
     <source_block_id>gsm_clock_offset_control_0</source_block_id>
     <sink_block_id>gsm_input_0</sink_block_id>
-    <source_key>ppm</source_key>
-    <sink_key>ppm_in</sink_key>
+    <source_key>ctrl</source_key>
+    <sink_key>ctrl_in</sink_key>
   </connection>
   <connection>
     <source_block_id>gsm_control_channels_decoder_0</source_block_id>
diff --git a/apps/grgsm_scanner b/apps/grgsm_scanner
index ebfdb7a..bbda35d 100755
--- a/apps/grgsm_scanner
+++ b/apps/grgsm_scanner
@@ -76,7 +76,7 @@
             samp_rate_in=samp_rate,
         )
         self.gsm_control_channels_decoder_0 = grgsm.control_channels_decoder()
-        self.gsm_clock_offset_control_0 = grgsm.clock_offset_control(fc)
+        self.gsm_clock_offset_control_0 = grgsm.clock_offset_control(fc, samp_rate)
         self.gsm_bcch_ccch_demapper_0 = grgsm.gsm_bcch_ccch_demapper(0)
 
         ##################################################
@@ -84,7 +84,7 @@
         ##################################################
         self.msg_connect(self.gsm_bcch_ccch_demapper_0, 'bursts', self, 'bursts')
         self.msg_connect(self.gsm_bcch_ccch_demapper_0, 'bursts', self.gsm_control_channels_decoder_0, 'bursts')
-        self.msg_connect(self.gsm_clock_offset_control_0, 'ppm', self.gsm_input_0, 'ppm_in')
+        self.msg_connect(self.gsm_clock_offset_control_0, 'ctrl', self.gsm_input_0, 'ctrl_in')
         self.msg_connect(self.gsm_control_channels_decoder_0, 'msgs', self, 'msgs')
         self.msg_connect(self.gsm_receiver_0, 'C0', self.gsm_bcch_ccch_demapper_0, 'bursts')
         self.msg_connect(self.gsm_receiver_0, 'measurements', self.gsm_clock_offset_control_0, 'measurements')
diff --git a/build.sh b/build.sh
deleted file mode 100755
index 8383aaf..0000000
--- a/build.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-# First, get into the right directory
-THISPATH=$(dirname "$BASH_SOURCE")
-cd $THISPATH
-
-# Now, we check to see that the version env var is set
-${CPACK_PACKAGE_VERSION:?"Need to set CPACK_PACKAGE_VERSION env var!"}
-export $CPACK_DEBIAN_PACKAGE_ARCHITECTURE=`dpkg --print-architecture`
-
-# OK, now we get down to the business of building...
-rm -rf ./build
-mkdir build
-cd build
-cmake ..
-make package
-cpack -G DEB
-mv ./*.deb ../installer-packages
-echo "If you've gotten to this point, the package has been built"
-echo "and exists at "$THISPATH"/installer-packages"
-echo "Don't forget to add and commit the new package, and tag the commit!"
diff --git a/debian/build-package b/debian/build-package
index d0d822a..269590b 100755
--- a/debian/build-package
+++ b/debian/build-package
@@ -1,8 +1,11 @@
 #!/bin/bash
+VERSION=0.40
+
 cd ../..
 
-tar -acf gr-gsm_0.3.orig.tar.gz gr-gsm
+tar -acf gr-gsm_${VERSION}.orig.tar.gz gr-gsm
 cd gr-gsm
 debuild -S -sa
+#pdebuild
 cd ..
-dput ppa:ptrkrysik/gr-gsm gr-gsm_0.3-0ppa0_source.changes
+dput ppa:ptrkrysik/gr-gsm gr-gsm_${VERSION}-0ppa0_source.changes
diff --git a/debian/changelog b/debian/changelog
index 2f7a22b..11c86a9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-gr-gsm (0.3-0ppa0) xenial; urgency=low
+gr-gsm (0.40-0ppa0) xenial; urgency=low
 
   * Initial upload!
 
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..f11c82a
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
\ No newline at end of file
diff --git a/debian/control b/debian/control
index d4e5661..a513300 100644
--- a/debian/control
+++ b/debian/control
@@ -1,13 +1,23 @@
 Source: gr-gsm
-Section: devel
+Section: libdevel
 Priority: optional
-Maintainer: Your Name <your.email@some.where>
-Build-Depends: cmake, build-essential, python-scipy, gnuradio-dev, gr-osmosdr, libosmocore-dev
+Maintainer: Piotr Krysik <ptrkrysik@gmail.com>
+Build-Depends: cmake,
+               debhelper (>= 9.0.0~),
+               pkg-config,
+               python-scipy,
+               gnuradio-dev,
+               libosmocore-dev,
+               python-dev,
+               swig
+X-Python-Version: >= 2.7, << 2.8
+Standards-Version: 3.9.7
+Homepage: http://github.com/ptrkrysik/gr-gsm/
+Vcs-Git: git://github.com/ptrkrysik/gr-gsm.git
+Vcs-Browser: https://github.com/ptrkrysik/gr-gsm/
 
-Homepage: http://www.yourhomepage.org
 Package: gr-gsm
 Architecture: any
-Depends:  ${shlibs:Depends}, ${misc:Depends}, gnuradio, gr-osmosdr, python-scipy
-Description: First test-package
- Long description of greet-the-world.
- It can span multiple lines!
+Pre-Depends: ${misc:Pre-Depends}
+Depends: gnuradio, gr-osmosdr, ${misc:Depends}, ${python:Depends}, ${shlibs:Depends}
+Description: Gnuradio blocks and tools for receiving GSM transmissions
diff --git a/debian/rules b/debian/rules
index 6b44c5b..cb59406 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,27 +1,15 @@
 #!/usr/bin/make -f
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+export DEB_HOST_MULTIARCH
 
-BUILDDIR = build
+%:
+	dh $@ --with python2 --parallel
 
-# secondly called by launchpad
-build:
-	mkdir $(BUILDDIR);
-	cd $(BUILDDIR); cmake -DCMAKE_INSTALL_PREFIX=../debian/tmp/usr ..
-	make -C $(BUILDDIR)
+override_dh_auto_configure:
+	dh_auto_configure -- -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" -DPythonLibs_FIND_VERSION:STRING="2.7" -DPYTHON_EXECUTABLE:STRING="/usr/bin/python"
 
-# thirdly called by launchpad
-binary: binary-indep binary-arch
+override_dh_auto_install:
+	dh_auto_install
+	rm -f debian/gr-gsm/usr/lib/python2.7/dist-packages/grgsm/*pyc
+	rm -f debian/gr-gsm/usr/lib/python2.7/dist-packages/grgsm/*pyo
 
-binary-indep:
-	# nothing to be done
-
-binary-arch:
-	cd $(BUILDDIR); cmake -P cmake_install.cmake
-	mkdir debian/tmp/DEBIAN
-	dpkg-gencontrol -pgr-gsm
-	dpkg --build debian/tmp ..
-
-# firstly called by launchpad
-clean:
-	rm -rf $(BUILDDIR)
-
-.PHONY: binary binary-arch binary-indep clean
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..46ebe02
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
\ No newline at end of file
diff --git a/examples b/examples
index 9446043..405c987 160000
--- a/examples
+++ b/examples
@@ -1 +1 @@
-Subproject commit 9446043efe0fe6883e4e962261230c9034ac71a9
+Subproject commit 405c987b2bdb76bcfb0951e7aa90c8fb75f2f8dd
diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt
index 47dfc89..2b94539 100644
--- a/grc/CMakeLists.txt
+++ b/grc/CMakeLists.txt
@@ -24,6 +24,5 @@
 add_subdirectory(flow_control)
 add_subdirectory(misc_utils)
 install(FILES
-    gsm_block_tree.xml
-    grgsm_msg_to_tag.xml DESTINATION share/gnuradio/grc/blocks
+    gsm_block_tree.xml DESTINATION share/gnuradio/grc/blocks
 )
diff --git a/grc/decoding/gsm_tch_f_decoder.xml b/grc/decoding/gsm_tch_f_decoder.xml
index 632162f..3d1152e 100644
--- a/grc/decoding/gsm_tch_f_decoder.xml
+++ b/grc/decoding/gsm_tch_f_decoder.xml
@@ -3,7 +3,7 @@
   <name>TCH/F decoder</name>
   <key>gsm_tch_f_decoder</key>
   <import>import grgsm</import>
-  <make>grgsm.tch_f_decoder($mode, $file, $boundary_check)</make>
+  <make>grgsm.tch_f_decoder($mode, $boundary_check)</make>
 
   <param>
     <name>TCH coding mode</name>
@@ -51,15 +51,9 @@
     </option>
   </param>
   <param>
-    <name>destination file</name>
-    <key>file</key>
-    <value>/tmp/speech.gsm</value>
-    <type>file_open</type>
-  </param>
-  <param>
     <name>Voice boundary detection</name>
     <key>boundary_check</key>
-    <value>True</value>
+    <value>False</value>
     <type>bool</type>
     <option>
       <name>False</name>
@@ -80,7 +74,12 @@
     <type>message</type>
     <optional>1</optional>
   </source>
-  
+  <source>
+    <name>voice</name>
+    <type>message</type>
+    <optional>1</optional>
+  </source>
+    
   <doc>
 If "Voice boundary detection" is enabled, then only bursts are decoded as voice where
 
diff --git a/grc/demapping/gsm_bcch_ccch_demapper.xml b/grc/demapping/gsm_bcch_ccch_demapper.xml
index ff392f1..239dcc9 100644
--- a/grc/demapping/gsm_bcch_ccch_demapper.xml
+++ b/grc/demapping/gsm_bcch_ccch_demapper.xml
@@ -1,5 +1,5 @@
 <block>
-  <name>BCCH + CCCH demapper</name>
+  <name>BCCH + CCCH Demapper</name>
   <key>gsm_bcch_ccch_demapper</key>
   <category></category>
   <import>import grgsm</import>
diff --git a/grc/demapping/gsm_bcch_ccch_sdcch4_demapper.xml b/grc/demapping/gsm_bcch_ccch_sdcch4_demapper.xml
index 94a433e..6c6845a 100644
--- a/grc/demapping/gsm_bcch_ccch_sdcch4_demapper.xml
+++ b/grc/demapping/gsm_bcch_ccch_sdcch4_demapper.xml
@@ -1,5 +1,5 @@
 <block>
-  <name>BCCH + CCCH + SDCCH/4 demapper</name>
+  <name>BCCH + CCCH + SDCCH/4 Demapper</name>
   <key>gsm_bcch_ccch_sdcch4_demapper</key>
   <category></category>
   <import>import grgsm</import>
diff --git a/grc/demapping/gsm_sdcch8_demapper.xml b/grc/demapping/gsm_sdcch8_demapper.xml
index 7507065..0c62a46 100644
--- a/grc/demapping/gsm_sdcch8_demapper.xml
+++ b/grc/demapping/gsm_sdcch8_demapper.xml
@@ -1,5 +1,5 @@
 <block>
-  <name>SDCCH/8 demapper</name>
+  <name>SDCCH/8 Demapper</name>
   <key>gsm_sdcch8_demapper</key>
   <category></category>
   <import>import grgsm</import>
diff --git a/grc/demapping/gsm_tch_f_chans_demapper.xml b/grc/demapping/gsm_tch_f_chans_demapper.xml
index 2a3f443..deb2187 100644
--- a/grc/demapping/gsm_tch_f_chans_demapper.xml
+++ b/grc/demapping/gsm_tch_f_chans_demapper.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>TCH/F chans demapper</name>
+  <name>TCH/F Demapper</name>
   <key>gsm_tch_f_chans_demapper</key>
   <import>import grgsm</import>
   <make>grgsm.tch_f_chans_demapper($timeslot_nr)</make>
diff --git a/grc/demapping/gsm_universal_ctrl_chans_demapper.xml b/grc/demapping/gsm_universal_ctrl_chans_demapper.xml
index f173752..dcad1ae 100644
--- a/grc/demapping/gsm_universal_ctrl_chans_demapper.xml
+++ b/grc/demapping/gsm_universal_ctrl_chans_demapper.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Universal ctrl chans demapper</name>
+  <name>Universal Control Channels Demapper</name>
   <key>gsm_universal_ctrl_chans_demapper</key>
   <import>import grgsm</import>
   <make>grgsm.universal_ctrl_chans_demapper($timeslot_nr, $downlink_starts_fn_mod51, $downlink_channel_types, $downlink_subslots, $uplink_starts_fn_mod51, $uplink_channel_types, $uplink_subslots)</make>
diff --git a/grc/flow_control/gsm_burst_fnr_filter.xml b/grc/flow_control/gsm_burst_fnr_filter.xml
index d09b6e6..7b27583 100644
--- a/grc/flow_control/gsm_burst_fnr_filter.xml
+++ b/grc/flow_control/gsm_burst_fnr_filter.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Burst framenumber filter</name>
+  <name>Burst Framenumber Filter</name>
   <key>gsm_burst_fnr_filter</key>
   <import>import grgsm</import>
   <make>grgsm.burst_fnr_filter($mode, $fnr)</make>
diff --git a/grc/flow_control/gsm_burst_sdcch_subslot_filter.xml b/grc/flow_control/gsm_burst_sdcch_subslot_filter.xml
index 81ae287..ddfcb3b 100644
--- a/grc/flow_control/gsm_burst_sdcch_subslot_filter.xml
+++ b/grc/flow_control/gsm_burst_sdcch_subslot_filter.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Burst SDCCH subslot filter</name>
+  <name>Burst SDCCH Subslot Filter</name>
   <key>gsm_burst_sdcch_subslot_filter</key>
   <import>import grgsm</import>
   <make>grgsm.burst_sdcch_subslot_filter($mode, $subslot)</make>
diff --git a/grc/flow_control/gsm_burst_sdcch_subslot_splitter.xml b/grc/flow_control/gsm_burst_sdcch_subslot_splitter.xml
index 4812d0b..62415e7 100644
--- a/grc/flow_control/gsm_burst_sdcch_subslot_splitter.xml
+++ b/grc/flow_control/gsm_burst_sdcch_subslot_splitter.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Burst SDCCH subslot splitter</name>
+  <name>Burst SDCCH Subslot Splitter</name>
   <key>gsm_burst_sdcch_subslot_splitter</key>
   <import>import grgsm</import>
   <make>grgsm.burst_sdcch_subslot_splitter(
diff --git a/grc/flow_control/gsm_burst_timeslot_filter.xml b/grc/flow_control/gsm_burst_timeslot_filter.xml
index 8af2b7b..b900375 100644
--- a/grc/flow_control/gsm_burst_timeslot_filter.xml
+++ b/grc/flow_control/gsm_burst_timeslot_filter.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Burst timeslot filter</name>
+  <name>Burst Timeslot Filter</name>
   <key>gsm_burst_timeslot_filter</key>
   <import>import grgsm</import>
   <make>grgsm.burst_timeslot_filter($timeslot)</make>
diff --git a/grc/flow_control/gsm_burst_timeslot_splitter.xml b/grc/flow_control/gsm_burst_timeslot_splitter.xml
index 91db4db..4f6159e 100644
--- a/grc/flow_control/gsm_burst_timeslot_splitter.xml
+++ b/grc/flow_control/gsm_burst_timeslot_splitter.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Burst timeslot splitter</name>
+  <name>Burst Timeslot Splitter</name>
   <key>gsm_burst_timeslot_splitter</key>
   <import>import grgsm</import>
   <make>grgsm.burst_timeslot_splitter()</make>
diff --git a/grc/flow_control/gsm_dummy_burst_filter.xml b/grc/flow_control/gsm_dummy_burst_filter.xml
index 046abbf..126e4fe 100644
--- a/grc/flow_control/gsm_dummy_burst_filter.xml
+++ b/grc/flow_control/gsm_dummy_burst_filter.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Dummy burst filter</name>
+  <name>Dummy Burst Filter</name>
   <key>gsm_dummy_burst_filter</key>
   <import>import grgsm</import>
   <make>grgsm.dummy_burst_filter()</make>
diff --git a/grc/grgsm_msg_to_tag.xml b/grc/grgsm_msg_to_tag.xml
deleted file mode 100644
index fab2c6c..0000000
--- a/grc/grgsm_msg_to_tag.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<block>
-  <name>msg_to_tag</name>
-  <key>grgsm_msg_to_tag</key>
-  <category>grgsm</category>
-  <import>import grgsm</import>
-  <make>grgsm.msg_to_tag()</make>
-  <!-- Make one 'param' node for every Parameter you want settable from the GUI.
-       Sub-nodes:
-       * name
-       * key (makes the value accessible as $keyname, e.g. in the make node)
-       * type -->
-  <param>
-    <name>...</name>
-    <key>...</key>
-    <type>...</type>
-  </param>
-
-  <!-- Make one 'sink' node per input. Sub-nodes:
-       * name (an identifier for the GUI)
-       * type
-       * vlen
-       * optional (set to 1 for optional inputs) -->
-  <sink>
-    <name>in</name>
-    <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
-  </sink>
-
-  <!-- Make one 'source' node per output. Sub-nodes:
-       * name (an identifier for the GUI)
-       * type
-       * vlen
-       * optional (set to 1 for optional inputs) -->
-  <source>
-    <name>out</name>
-    <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
-  </source>
-</block>
diff --git a/grc/gsm_block_tree.xml b/grc/gsm_block_tree.xml
index 0b15562..99628d6 100644
--- a/grc/gsm_block_tree.xml
+++ b/grc/gsm_block_tree.xml
@@ -59,8 +59,10 @@
       <block>gsm_extract_immediate_assignment</block>
       <block>gsm_controlled_rotator_cc</block>
       <block>gsm_controlled_const_source_f</block>
+      <block>gsm_controlled_fractional_resampler_cc</block>
       <block>gsm_message_printer</block>
       <block>gsm_clock_offset_corrector</block>
+      <block>gsm_clock_offset_corrector_tagged</block>
       <block>gsm_tmsi_dumper</block>
     </cat>
   </cat>
diff --git a/grc/misc_utils/CMakeLists.txt b/grc/misc_utils/CMakeLists.txt
index 99985a1..a64d2eb 100644
--- a/grc/misc_utils/CMakeLists.txt
+++ b/grc/misc_utils/CMakeLists.txt
@@ -25,9 +25,12 @@
     gsm_message_printer.xml
     gsm_bursts_printer.xml
     gsm_clock_offset_corrector.xml
+    gsm_clock_offset_corrector_tagged.xml
     gsm_tmsi_dumper.xml
     gsm_burst_file_sink.xml
     gsm_burst_file_source.xml
     gsm_message_file_sink.xml
-    gsm_message_file_source.xml DESTINATION share/gnuradio/grc/blocks
+    gsm_message_file_source.xml
+    gsm_msg_to_tag.xml
+    gsm_controlled_fractional_resampler_cc.xml DESTINATION share/gnuradio/grc/blocks
 )
diff --git a/grc/misc_utils/gsm_burst_file_sink.xml b/grc/misc_utils/gsm_burst_file_sink.xml
index e468e5f..61bde2d 100644
--- a/grc/misc_utils/gsm_burst_file_sink.xml
+++ b/grc/misc_utils/gsm_burst_file_sink.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Burst file sink</name>
+  <name>Burst File Sink</name>
   <key>gsm_burst_file_sink</key>
   <import>import grgsm</import>
   <make>grgsm.burst_file_sink($filename)</make>
diff --git a/grc/misc_utils/gsm_burst_file_source.xml b/grc/misc_utils/gsm_burst_file_source.xml
index e32a708..5e160fb 100644
--- a/grc/misc_utils/gsm_burst_file_source.xml
+++ b/grc/misc_utils/gsm_burst_file_source.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Burst file source</name>
+  <name>Burst File Source</name>
   <key>gsm_burst_file_source</key>
   <import>import grgsm</import>
   <make>grgsm.burst_file_source($filename)</make>
diff --git a/grc/misc_utils/gsm_bursts_printer.xml b/grc/misc_utils/gsm_bursts_printer.xml
index 821e6bb..d6ddfcb 100644
--- a/grc/misc_utils/gsm_bursts_printer.xml
+++ b/grc/misc_utils/gsm_bursts_printer.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Bursts printer</name>
+  <name>Bursts Printer</name>
   <key>gsm_bursts_printer</key>
   <import>import grgsm</import>
   <import>import pmt</import>
diff --git a/grc/misc_utils/gsm_clock_offset_corrector.xml b/grc/misc_utils/gsm_clock_offset_corrector.xml
index c94677b..1a58397 100644
--- a/grc/misc_utils/gsm_clock_offset_corrector.xml
+++ b/grc/misc_utils/gsm_clock_offset_corrector.xml
@@ -1,5 +1,5 @@
 <block>
-  <name>Clock offset corrector</name>
+  <name>Clock Offset Corrector</name>
   <key>gsm_clock_offset_corrector</key>
   <import>import grgsm</import>
   <make>grgsm.clock_offset_corrector(
diff --git a/grc/misc_utils/gsm_clock_offset_corrector_tagged.xml b/grc/misc_utils/gsm_clock_offset_corrector_tagged.xml
new file mode 100644
index 0000000..4f91b4b
--- /dev/null
+++ b/grc/misc_utils/gsm_clock_offset_corrector_tagged.xml
@@ -0,0 +1,50 @@
+<block>
+  <name>Clock Offset Corrector Tagged</name>
+  <key>gsm_clock_offset_corrector_tagged</key>
+  <import>from clock_offset_corrector_tagged import clock_offset_corrector_tagged  # grc-generated hier_block</import>
+  <make>grgsm.clock_offset_corrector_tagged(
+    fc=$fc,
+    ppm=$ppm,
+    samp_rate_in=$samp_rate_in,
+)</make>
+  <callback>set_fc($fc)</callback>
+  <callback>set_ppm($ppm)</callback>
+  <callback>set_samp_rate_in($samp_rate_in)</callback>
+  <param>
+    <name>fc</name>
+    <key>fc</key>
+    <value>fc</value>
+    <type>float</type>
+  </param>
+  <param>
+    <name>ppm</name>
+    <key>ppm</key>
+    <value>ppm</value>
+    <type>float</type>
+  </param>
+  <param>
+    <name>samp_rate_in</name>
+    <key>samp_rate_in</key>
+    <value>samp_rate_in</value>
+    <type>float</type>
+  </param>
+  <sink>
+    <name>ctrl</name>
+    <type>message</type>
+    <optional>1</optional>
+  </sink>
+  <sink>
+    <name>in</name>
+    <type>complex</type>
+    <vlen>1</vlen>
+  </sink>
+  <source>
+    <name>out</name>
+    <type>complex</type>
+    <vlen>1</vlen>
+  </source>
+  <doc>Piotr Krysik
+Clock offset corrector with blocks that use tags to switch offsets
+</doc>
+  <grc_source>gr-gsm/hier_blocks/misc_utils/gsm_clock_offset_corrector_tagged.grc</grc_source>
+</block>
diff --git a/grc/misc_utils/gsm_controlled_const_source_f.xml b/grc/misc_utils/gsm_controlled_const_source_f.xml
index 10ae06f..603fc5c 100644
--- a/grc/misc_utils/gsm_controlled_const_source_f.xml
+++ b/grc/misc_utils/gsm_controlled_const_source_f.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Controlled const source</name>
+  <name>Controlled Const Source</name>
   <key>gsm_controlled_const_source_f</key>
   <import>import grgsm</import>
   <make>grgsm.controlled_const_source_f($constant)</make>
diff --git a/grc/misc_utils/gsm_controlled_fractional_resampler_cc.xml b/grc/misc_utils/gsm_controlled_fractional_resampler_cc.xml
new file mode 100644
index 0000000..fdecece
--- /dev/null
+++ b/grc/misc_utils/gsm_controlled_fractional_resampler_cc.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<block>
+  <name>Controlled Fractional Resampler</name>
+  <key>gsm_controlled_fractional_resampler_cc</key>
+  <import>import grgsm</import>
+  <make>grgsm.controlled_fractional_resampler_cc($phase_shift, $resamp_ratio)</make>
+	<callback>set_resamp_ratio($resamp_ratio)</callback>
+	<param>
+		<name>Phase Shift</name>
+		<key>phase_shift</key>
+		<type>real</type>
+	</param>
+	<param>
+		<name>Resampling Ratio</name>
+		<key>resamp_ratio</key>
+		<type>real</type>
+	</param>
+	<sink>
+		<name>in</name>
+		<type>complex</type>
+	</sink>
+	<source>
+		<name>out</name>
+		<type>complex</type>
+	</source>
+</block>
diff --git a/grc/misc_utils/gsm_controlled_rotator_cc.xml b/grc/misc_utils/gsm_controlled_rotator_cc.xml
index 9d2f1d7..e280de9 100644
--- a/grc/misc_utils/gsm_controlled_rotator_cc.xml
+++ b/grc/misc_utils/gsm_controlled_rotator_cc.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Controlled rotator</name>
+  <name>Controlled Rotator</name>
   <key>gsm_controlled_rotator_cc</key>
   <import>import grgsm</import>
   <make>grgsm.controlled_rotator_cc($phase_inc,$samp_rate)</make>
@@ -27,6 +27,7 @@
   <sink>
     <name>phase_inc</name>
     <type>float</type>
+    <optional>1</optional>
   </sink>
   
   <source>
diff --git a/grc/misc_utils/gsm_extract_immediate_assignment.xml b/grc/misc_utils/gsm_extract_immediate_assignment.xml
index efb62da..9040b9b 100644
--- a/grc/misc_utils/gsm_extract_immediate_assignment.xml
+++ b/grc/misc_utils/gsm_extract_immediate_assignment.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Extract immediate assignment</name>
+  <name>Extract Immediate Assignment</name>
   <key>gsm_extract_immediate_assignment</key>
   <import>import grgsm</import>
   <make>grgsm.extract_immediate_assignment($print_immediate_assignments, $ignore_gprs, $unique_references)</make>
diff --git a/grc/misc_utils/gsm_extract_system_info.xml b/grc/misc_utils/gsm_extract_system_info.xml
index 3a2a13e..4a5d26d 100644
--- a/grc/misc_utils/gsm_extract_system_info.xml
+++ b/grc/misc_utils/gsm_extract_system_info.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Extract system info</name>
+  <name>Extract System Info</name>
   <key>gsm_extract_system_info</key>
   <import>import grgsm</import>
   <make>grgsm.extract_system_info()</make>
diff --git a/grc/misc_utils/gsm_message_file_sink.xml b/grc/misc_utils/gsm_message_file_sink.xml
index 5d4975d..087747e 100644
--- a/grc/misc_utils/gsm_message_file_sink.xml
+++ b/grc/misc_utils/gsm_message_file_sink.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Message file sink</name>
+  <name>Message File Sink</name>
   <key>gsm_message_file_sink</key>
   <import>import grgsm</import>
   <make>grgsm.message_file_sink($filename)</make>
diff --git a/grc/misc_utils/gsm_message_file_source.xml b/grc/misc_utils/gsm_message_file_source.xml
index 7095749..7876c77 100644
--- a/grc/misc_utils/gsm_message_file_source.xml
+++ b/grc/misc_utils/gsm_message_file_source.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Message file source</name>
+  <name>Message File Source</name>
   <key>gsm_message_file_source</key>
   <import>import grgsm</import>
   <make>grgsm.message_file_source($filename)</make>
diff --git a/grc/misc_utils/gsm_message_printer.xml b/grc/misc_utils/gsm_message_printer.xml
index 0e93f1b..be50b78 100644
--- a/grc/misc_utils/gsm_message_printer.xml
+++ b/grc/misc_utils/gsm_message_printer.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Message printer</name>
+  <name>Message Printer</name>
   <key>gsm_message_printer</key>
   <import>import grgsm</import>
   <import>import pmt</import>
diff --git a/grc/misc_utils/gsm_msg_to_tag.xml b/grc/misc_utils/gsm_msg_to_tag.xml
new file mode 100644
index 0000000..c0d73c3
--- /dev/null
+++ b/grc/misc_utils/gsm_msg_to_tag.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<block>
+  <name>Message To Tag</name>
+  <key>gsm_msg_to_tag</key>
+  <import>import grgsm</import>
+  <make>grgsm.msg_to_tag()</make>
+
+  <sink>
+    <name>in</name>
+    <type>complex</type>
+  </sink>
+
+  <sink>
+    <name>msg</name>
+    <type>message</type>
+    <optional>1</optional>
+  </sink>
+
+  <source>
+    <name>out</name>
+    <type>complex</type>
+  </source>
+</block>
diff --git a/grc/qa_utils/gsm_burst_sink.xml b/grc/qa_utils/gsm_burst_sink.xml
index 740960f..1026993 100644
--- a/grc/qa_utils/gsm_burst_sink.xml
+++ b/grc/qa_utils/gsm_burst_sink.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Burst sink</name>
+  <name>Burst Sink</name>
   <key>gsm_burst_sink</key>
   <import>import grgsm</import>
   <make>grgsm.burst_sink()</make>
diff --git a/grc/qa_utils/gsm_burst_source.xml b/grc/qa_utils/gsm_burst_source.xml
index 9f55ac5..d3da677 100644
--- a/grc/qa_utils/gsm_burst_source.xml
+++ b/grc/qa_utils/gsm_burst_source.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Burst source</name>
+  <name>Burst Source</name>
   <key>gsm_burst_source</key>
   <import>import grgsm</import>
   <make>grgsm.burst_source($framenumbers, $timeslots, $bursts)</make>
diff --git a/grc/receiver/gsm_clock_offset_control.xml b/grc/receiver/gsm_clock_offset_control.xml
index 77840a5..704d2f3 100644
--- a/grc/receiver/gsm_clock_offset_control.xml
+++ b/grc/receiver/gsm_clock_offset_control.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0"?>
 <block>
-  <name>GSM clock offset control</name>
+  <name>GSM Clock Offset Control</name>
   <key>gsm_clock_offset_control</key>
   <import>import grgsm</import>
-  <make>grgsm.clock_offset_control($fc)</make>
+  <make>grgsm.clock_offset_control($fc, $samp_rate)</make>
   <callback></callback>
   <param>
     <name>fc</name>
@@ -12,13 +12,20 @@
     <type>float</type>
   </param>
 
+  <param>
+    <name>samp_rate</name>
+    <key>samp_rate</key>
+    <value>samp_rate</value>
+    <type>float</type>
+  </param>
+
   <sink>
     <name>measurements</name>
     <type>message</type>
   </sink>
 
   <source>
-    <name>ppm</name>
+    <name>ctrl</name>
     <type>message</type>
     <optional>1</optional>
   </source>
diff --git a/grc/receiver/gsm_cx_channel_hopper.xml b/grc/receiver/gsm_cx_channel_hopper.xml
index 903c1a0..9ff07dc 100644
--- a/grc/receiver/gsm_cx_channel_hopper.xml
+++ b/grc/receiver/gsm_cx_channel_hopper.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>CX channel hopper</name>
+  <name>CX Channel Hopper</name>
   <key>gsm_cx_channel_hopper</key>
   <import>import grgsm</import>
   <make>grgsm.cx_channel_hopper($ma, $maio, $hsn)</make>
diff --git a/grc/receiver/gsm_fcch_burst_tagger.xml b/grc/receiver/gsm_fcch_burst_tagger.xml
index 85afd20..a0cb977 100644
--- a/grc/receiver/gsm_fcch_burst_tagger.xml
+++ b/grc/receiver/gsm_fcch_burst_tagger.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>FCCH burst tagger</name>
+  <name>FCCH Burst Tagger</name>
   <key>gsm_fcch_burst_tagger</key>
   <import>import grgsm</import>
   <make>grgsm.fcch_burst_tagger($OSR)</make>
diff --git a/grc/receiver/gsm_fcch_detector.xml b/grc/receiver/gsm_fcch_detector.xml
index 36f2d08..f8f8997 100644
--- a/grc/receiver/gsm_fcch_detector.xml
+++ b/grc/receiver/gsm_fcch_detector.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>FCCH bursts detector</name>
+  <name>FCCH Bursts Detector</name>
   <key>gsm_fcch_detector</key>
   <import>import grgsm</import>
   <make>grgsm.fcch_detector($OSR)</make>
diff --git a/grc/receiver/gsm_input.xml b/grc/receiver/gsm_input.xml
index 9a9dc7c..52445da 100644
--- a/grc/receiver/gsm_input.xml
+++ b/grc/receiver/gsm_input.xml
@@ -1,5 +1,5 @@
 <block>
-  <name>GSM input adaptor</name>
+  <name>GSM Input Adaptor</name>
   <key>gsm_input</key>
   <category></category>
   <import>import grgsm</import>
@@ -47,7 +47,7 @@
     <vlen>1</vlen>
   </sink>
   <sink>
-    <name>ppm_in</name>
+    <name>ctrl_in</name>
     <type>message</type>
     <optional>True</optional>
   </sink>
diff --git a/grc/receiver/gsm_sch_detector.xml b/grc/receiver/gsm_sch_detector.xml
index 7333a6e..b3adb56 100644
--- a/grc/receiver/gsm_sch_detector.xml
+++ b/grc/receiver/gsm_sch_detector.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>SCH bursts detector</name>
+  <name>SCH Bursts Detector</name>
   <key>gsm_sch_detector</key>
   <import>import grgsm</import>
   <make>grgsm.sch_detector($OSR)</make>
diff --git a/grc/receiver/gsm_wideband_input.xml b/grc/receiver/gsm_wideband_input.xml
index f05c4b6..54a2f76 100644
--- a/grc/receiver/gsm_wideband_input.xml
+++ b/grc/receiver/gsm_wideband_input.xml
@@ -1,5 +1,5 @@
 <block>
-  <name>GSM wideband input adaptor</name>
+  <name>GSM Wideband Input Adaptor</name>
   <key>gsm_wideband_input</key>
   <category></category>
   <import>import grgsm</import>
diff --git a/hier_blocks/misc_utils/gsm_clock_offset_corrector_new.grc b/hier_blocks/misc_utils/gsm_clock_offset_corrector_new.grc
new file mode 100644
index 0000000..390fce6
--- /dev/null
+++ b/hier_blocks/misc_utils/gsm_clock_offset_corrector_new.grc
@@ -0,0 +1,494 @@
+<?xml version='1.0' encoding='utf-8'?>
+<?grc format='1' created='3.7.9'?>
+<flow_graph>
+  <timestamp>Thu Nov  6 10:22:20 2014</timestamp>
+  <block>
+    <key>options</key>
+    <param>
+      <key>author</key>
+      <value>Piotr Krysik</value>
+    </param>
+    <param>
+      <key>window_size</key>
+      <value>2280, 1024</value>
+    </param>
+    <param>
+      <key>category</key>
+      <value>GSM</value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>description</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(10, 10)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>generate_options</key>
+      <value>hb</value>
+    </param>
+    <param>
+      <key>hier_block_src_path</key>
+      <value>.:</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>clock_offset_corrector_new</value>
+    </param>
+    <param>
+      <key>max_nouts</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>qt_qss_theme</key>
+      <value></value>
+    </param>
+    <param>
+      <key>realtime_scheduling</key>
+      <value></value>
+    </param>
+    <param>
+      <key>run_command</key>
+      <value>{python} -u {filename}</value>
+    </param>
+    <param>
+      <key>run_options</key>
+      <value>prompt</value>
+    </param>
+    <param>
+      <key>run</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>thread_safe_setters</key>
+      <value></value>
+    </param>
+    <param>
+      <key>title</key>
+      <value>Clock offset corrector</value>
+    </param>
+  </block>
+  <block>
+    <key>variable</key>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(736, 19)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>samp_rate_out</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>samp_rate_in</value>
+    </param>
+  </block>
+  <block>
+    <key>pad_source</key>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(32, 244)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>ctrl_in</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>ctrl_in</value>
+    </param>
+    <param>
+      <key>num_streams</key>
+      <value>1</value>
+    </param>
+    <param>
+      <key>optional</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>message</value>
+    </param>
+    <param>
+      <key>vlen</key>
+      <value>1</value>
+    </param>
+  </block>
+  <block>
+    <key>parameter</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(274, 19)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>fc</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>fc</value>
+    </param>
+    <param>
+      <key>short_id</key>
+      <value></value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>eng_float</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>936.6e6</value>
+    </param>
+  </block>
+  <block>
+    <key>grgsm_msg_to_tag</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>affinity</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(192, 193)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>grgsm_msg_to_tag_0</value>
+    </param>
+    <param>
+      <key>maxoutbuf</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>minoutbuf</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>import</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(11, 125)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>math_imp</value>
+    </param>
+    <param>
+      <key>import</key>
+      <value>import math</value>
+    </param>
+  </block>
+  <block>
+    <key>pad_sink</key>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(1168, 204)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>pad_sink_1</value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>complex</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>out</value>
+    </param>
+    <param>
+      <key>num_streams</key>
+      <value>1</value>
+    </param>
+    <param>
+      <key>optional</key>
+      <value>False</value>
+    </param>
+    <param>
+      <key>vlen</key>
+      <value>1</value>
+    </param>
+  </block>
+  <block>
+    <key>pad_source</key>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(32, 188)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>pad_source_0</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>in</value>
+    </param>
+    <param>
+      <key>num_streams</key>
+      <value>1</value>
+    </param>
+    <param>
+      <key>optional</key>
+      <value>False</value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>complex</value>
+    </param>
+    <param>
+      <key>vlen</key>
+      <value>1</value>
+    </param>
+  </block>
+  <block>
+    <key>parameter</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(496, 19)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>ppm</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>ppm</value>
+    </param>
+    <param>
+      <key>short_id</key>
+      <value></value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>eng_float</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>parameter</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(368, 19)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>samp_rate_in</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>samp_rate_in</value>
+    </param>
+    <param>
+      <key>short_id</key>
+      <value></value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>eng_float</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>1625000.0/6.0*4.0</value>
+    </param>
+  </block>
+  <block>
+    <key>parameter</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>False</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(592, 20)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>samp_rate_out</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>samp_rate_out</value>
+    </param>
+    <param>
+      <key>short_id</key>
+      <value></value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>eng_float</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>1625000.0/6.0*4.0</value>
+    </param>
+  </block>
+  <connection>
+    <source_block_id>ctrl_in</source_block_id>
+    <sink_block_id>grgsm_msg_to_tag_0</sink_block_id>
+    <source_key>out</source_key>
+    <sink_key>msg</sink_key>
+  </connection>
+  <connection>
+    <source_block_id>pad_source_0</source_block_id>
+    <sink_block_id>grgsm_msg_to_tag_0</sink_block_id>
+    <source_key>0</source_key>
+    <sink_key>0</sink_key>
+  </connection>
+</flow_graph>
diff --git a/hier_blocks/misc_utils/gsm_clock_offset_corrector_tagged.grc b/hier_blocks/misc_utils/gsm_clock_offset_corrector_tagged.grc
new file mode 100644
index 0000000..61d8db7
--- /dev/null
+++ b/hier_blocks/misc_utils/gsm_clock_offset_corrector_tagged.grc
@@ -0,0 +1,606 @@
+<?xml version='1.0' encoding='utf-8'?>
+<?grc format='1' created='3.7.9'?>
+<flow_graph>
+  <timestamp>Thu Nov  6 10:22:20 2014</timestamp>
+  <block>
+    <key>options</key>
+    <param>
+      <key>author</key>
+      <value>Piotr Krysik</value>
+    </param>
+    <param>
+      <key>window_size</key>
+      <value>2280, 1024</value>
+    </param>
+    <param>
+      <key>category</key>
+      <value>GSM</value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>description</key>
+      <value>Clock offset corrector with blocks that use tags to switch offsets</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(10, 10)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>generate_options</key>
+      <value>hb</value>
+    </param>
+    <param>
+      <key>hier_block_src_path</key>
+      <value>.:</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>clock_offset_corrector_tagged</value>
+    </param>
+    <param>
+      <key>max_nouts</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>qt_qss_theme</key>
+      <value></value>
+    </param>
+    <param>
+      <key>realtime_scheduling</key>
+      <value></value>
+    </param>
+    <param>
+      <key>run_command</key>
+      <value>{python} -u {filename}</value>
+    </param>
+    <param>
+      <key>run_options</key>
+      <value>prompt</value>
+    </param>
+    <param>
+      <key>run</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>thread_safe_setters</key>
+      <value></value>
+    </param>
+    <param>
+      <key>title</key>
+      <value>Clock offset corrector tagged</value>
+    </param>
+  </block>
+  <block>
+    <key>variable</key>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(736, 19)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>samp_rate_out</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>samp_rate_in</value>
+    </param>
+  </block>
+  <block>
+    <key>pad_source</key>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(32, 244)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>ctrl</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>ctrl</value>
+    </param>
+    <param>
+      <key>num_streams</key>
+      <value>1</value>
+    </param>
+    <param>
+      <key>optional</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>message</value>
+    </param>
+    <param>
+      <key>vlen</key>
+      <value>1</value>
+    </param>
+  </block>
+  <block>
+    <key>parameter</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(274, 19)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>fc</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>fc</value>
+    </param>
+    <param>
+      <key>short_id</key>
+      <value></value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>eng_float</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>936.6e6</value>
+    </param>
+  </block>
+  <block>
+    <key>grgsm_controlled_fractional_resampler_cc</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>affinity</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>1</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(328, 197)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>grgsm_controlled_fractional_resampler_cc_0</value>
+    </param>
+    <param>
+      <key>maxoutbuf</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>minoutbuf</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>phase_shift</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>resamp_ratio</key>
+      <value>1.0</value>
+    </param>
+  </block>
+  <block>
+    <key>grgsm_msg_to_tag</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>affinity</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(192, 193)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>grgsm_msg_to_tag_0</value>
+    </param>
+    <param>
+      <key>maxoutbuf</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>minoutbuf</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>gsm_controlled_rotator_cc</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>affinity</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(608, 209)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>gsm_controlled_rotator_cc_0</value>
+    </param>
+    <param>
+      <key>maxoutbuf</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>minoutbuf</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>phase_inc</key>
+      <value>ppm/1.0e6*2*math.pi*fc/samp_rate_in</value>
+    </param>
+    <param>
+      <key>samp_rate</key>
+      <value>samp_rate_out</value>
+    </param>
+  </block>
+  <block>
+    <key>import</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(11, 125)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>math_imp</value>
+    </param>
+    <param>
+      <key>import</key>
+      <value>import math</value>
+    </param>
+  </block>
+  <block>
+    <key>pad_sink</key>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(784, 220)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>pad_sink_1</value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>complex</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>out</value>
+    </param>
+    <param>
+      <key>num_streams</key>
+      <value>1</value>
+    </param>
+    <param>
+      <key>optional</key>
+      <value>False</value>
+    </param>
+    <param>
+      <key>vlen</key>
+      <value>1</value>
+    </param>
+  </block>
+  <block>
+    <key>pad_source</key>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(32, 188)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>pad_source_0</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>in</value>
+    </param>
+    <param>
+      <key>num_streams</key>
+      <value>1</value>
+    </param>
+    <param>
+      <key>optional</key>
+      <value>False</value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>complex</value>
+    </param>
+    <param>
+      <key>vlen</key>
+      <value>1</value>
+    </param>
+  </block>
+  <block>
+    <key>parameter</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(496, 19)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>ppm</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>ppm</value>
+    </param>
+    <param>
+      <key>short_id</key>
+      <value></value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>eng_float</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>parameter</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(368, 19)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>samp_rate_in</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>samp_rate_in</value>
+    </param>
+    <param>
+      <key>short_id</key>
+      <value></value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>eng_float</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>1625000.0/6.0*4.0</value>
+    </param>
+  </block>
+  <block>
+    <key>parameter</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>False</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(592, 20)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>samp_rate_out</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>samp_rate_out</value>
+    </param>
+    <param>
+      <key>short_id</key>
+      <value></value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>eng_float</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>1625000.0/6.0*4.0</value>
+    </param>
+  </block>
+  <connection>
+    <source_block_id>ctrl</source_block_id>
+    <sink_block_id>grgsm_msg_to_tag_0</sink_block_id>
+    <source_key>out</source_key>
+    <sink_key>msg</sink_key>
+  </connection>
+  <connection>
+    <source_block_id>grgsm_controlled_fractional_resampler_cc_0</source_block_id>
+    <sink_block_id>gsm_controlled_rotator_cc_0</sink_block_id>
+    <source_key>0</source_key>
+    <sink_key>0</sink_key>
+  </connection>
+  <connection>
+    <source_block_id>grgsm_msg_to_tag_0</source_block_id>
+    <sink_block_id>grgsm_controlled_fractional_resampler_cc_0</sink_block_id>
+    <source_key>0</source_key>
+    <sink_key>0</sink_key>
+  </connection>
+  <connection>
+    <source_block_id>gsm_controlled_rotator_cc_0</source_block_id>
+    <sink_block_id>pad_sink_1</sink_block_id>
+    <source_key>0</source_key>
+    <sink_key>0</sink_key>
+  </connection>
+  <connection>
+    <source_block_id>pad_source_0</source_block_id>
+    <sink_block_id>grgsm_msg_to_tag_0</sink_block_id>
+    <source_key>0</source_key>
+    <sink_key>0</sink_key>
+  </connection>
+</flow_graph>
diff --git a/hier_blocks/receiver/gsm_input.grc b/hier_blocks/receiver/gsm_input.grc
index 685f0b2..300dff5 100644
--- a/hier_blocks/receiver/gsm_input.grc
+++ b/hier_blocks/receiver/gsm_input.grc
@@ -1,42 +1,70 @@
-<?xml version='1.0' encoding='ASCII'?>
-<?grc format='1' created='3.7.6'?>
+<?xml version='1.0' encoding='utf-8'?>
+<?grc format='1' created='3.7.9'?>
 <flow_graph>
   <timestamp>Thu Nov  6 14:41:06 2014</timestamp>
   <block>
     <key>options</key>
     <param>
-      <key>id</key>
-      <value>gsm_input</value>
-    </param>
-    <param>
-      <key>_enabled</key>
-      <value>True</value>
-    </param>
-    <param>
-      <key>title</key>
-      <value>GSM input adaptor</value>
-    </param>
-    <param>
       <key>author</key>
       <value>Piotr Krysik</value>
     </param>
     <param>
-      <key>description</key>
-      <value>Adaptor of input stream for the GSM receiver. Contains frequency ofset corrector doing also resampling to integer multiplies of GSM sample rate and LP filter filtering GSM channel.</value>
-    </param>
-    <param>
       <key>window_size</key>
       <value>1280, 1024</value>
     </param>
     <param>
+      <key>category</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>description</key>
+      <value>Adaptor of input stream for the GSM receiver. Contains frequency ofset corrector doing also resampling to integer multiplies of GSM sample rate and LP filter filtering GSM channel.</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(10, 10)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
       <key>generate_options</key>
       <value>hb</value>
     </param>
     <param>
-      <key>category</key>
+      <key>hier_block_src_path</key>
+      <value>.:</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>gsm_input</value>
+    </param>
+    <param>
+      <key>max_nouts</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>qt_qss_theme</key>
       <value></value>
     </param>
     <param>
+      <key>realtime_scheduling</key>
+      <value></value>
+    </param>
+    <param>
+      <key>run_command</key>
+      <value>{python} -u {filename}</value>
+    </param>
+    <param>
       <key>run_options</key>
       <value>prompt</value>
     </param>
@@ -45,45 +73,25 @@
       <value>True</value>
     </param>
     <param>
-      <key>max_nouts</key>
-      <value>0</value>
-    </param>
-    <param>
-      <key>realtime_scheduling</key>
+      <key>thread_safe_setters</key>
       <value></value>
     </param>
     <param>
-      <key>alias</key>
-      <value></value>
-    </param>
-    <param>
-      <key>_coordinate</key>
-      <value>(10, 10)</value>
-    </param>
-    <param>
-      <key>_rotation</key>
-      <value>0</value>
+      <key>title</key>
+      <value>GSM input adaptor</value>
     </param>
   </block>
   <block>
     <key>variable</key>
     <param>
-      <key>id</key>
-      <value>samp_rate_out</value>
+      <key>comment</key>
+      <value></value>
     </param>
     <param>
       <key>_enabled</key>
       <value>True</value>
     </param>
     <param>
-      <key>value</key>
-      <value>1625000.0/6.0*osr</value>
-    </param>
-    <param>
-      <key>alias</key>
-      <value></value>
-    </param>
-    <param>
       <key>_coordinate</key>
       <value>(632, 19)</value>
     </param>
@@ -91,116 +99,73 @@
       <key>_rotation</key>
       <value>0</value>
     </param>
-  </block>
-  <block>
-    <key>parameter</key>
     <param>
       <key>id</key>
-      <value>ppm</value>
+      <value>samp_rate_out</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>1625000.0/6.0*osr</value>
+    </param>
+  </block>
+  <block>
+    <key>pad_source</key>
+    <param>
+      <key>comment</key>
+      <value></value>
     </param>
     <param>
       <key>_enabled</key>
       <value>True</value>
     </param>
     <param>
-      <key>label</key>
-      <value>ppm</value>
-    </param>
-    <param>
-      <key>value</key>
-      <value>0</value>
-    </param>
-    <param>
-      <key>type</key>
-      <value>eng_float</value>
-    </param>
-    <param>
-      <key>short_id</key>
-      <value></value>
-    </param>
-    <param>
-      <key>alias</key>
-      <value></value>
-    </param>
-    <param>
       <key>_coordinate</key>
-      <value>(453, 22)</value>
+      <value>(56, 188)</value>
     </param>
     <param>
       <key>_rotation</key>
       <value>0</value>
     </param>
-  </block>
-  <block>
-    <key>parameter</key>
     <param>
       <key>id</key>
-      <value>osr</value>
-    </param>
-    <param>
-      <key>_enabled</key>
-      <value>True</value>
+      <value>ctrl_in</value>
     </param>
     <param>
       <key>label</key>
-      <value>OSR</value>
+      <value>ctrl_in</value>
     </param>
     <param>
-      <key>value</key>
-      <value>4</value>
+      <key>num_streams</key>
+      <value>1</value>
+    </param>
+    <param>
+      <key>optional</key>
+      <value>True</value>
     </param>
     <param>
       <key>type</key>
-      <value>intx</value>
+      <value>message</value>
     </param>
     <param>
-      <key>short_id</key>
-      <value></value>
-    </param>
-    <param>
-      <key>alias</key>
-      <value></value>
-    </param>
-    <param>
-      <key>_coordinate</key>
-      <value>(541, 23)</value>
-    </param>
-    <param>
-      <key>_rotation</key>
-      <value>0</value>
+      <key>vlen</key>
+      <value>1</value>
     </param>
   </block>
   <block>
     <key>parameter</key>
     <param>
-      <key>id</key>
-      <value>fc</value>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
     </param>
     <param>
       <key>_enabled</key>
       <value>True</value>
     </param>
     <param>
-      <key>label</key>
-      <value>fc</value>
-    </param>
-    <param>
-      <key>value</key>
-      <value>940e6</value>
-    </param>
-    <param>
-      <key>type</key>
-      <value>eng_float</value>
-    </param>
-    <param>
-      <key>short_id</key>
-      <value></value>
-    </param>
-    <param>
-      <key>alias</key>
-      <value></value>
-    </param>
-    <param>
       <key>_coordinate</key>
       <value>(231, 22)</value>
     </param>
@@ -208,94 +173,35 @@
       <key>_rotation</key>
       <value>0</value>
     </param>
-  </block>
-  <block>
-    <key>parameter</key>
     <param>
       <key>id</key>
-      <value>samp_rate_in</value>
-    </param>
-    <param>
-      <key>_enabled</key>
-      <value>True</value>
+      <value>fc</value>
     </param>
     <param>
       <key>label</key>
-      <value>samp_rate_in</value>
-    </param>
-    <param>
-      <key>value</key>
-      <value>1e6</value>
-    </param>
-    <param>
-      <key>type</key>
-      <value>eng_float</value>
+      <value>fc</value>
     </param>
     <param>
       <key>short_id</key>
       <value></value>
     </param>
     <param>
+      <key>type</key>
+      <value>eng_float</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>940e6</value>
+    </param>
+  </block>
+  <block>
+    <key>fractional_resampler_xx</key>
+    <param>
       <key>alias</key>
       <value></value>
     </param>
     <param>
-      <key>_coordinate</key>
-      <value>(328, 22)</value>
-    </param>
-    <param>
-      <key>_rotation</key>
-      <value>0</value>
-    </param>
-  </block>
-  <block>
-    <key>low_pass_filter</key>
-    <param>
-      <key>id</key>
-      <value>low_pass_filter_0_0</value>
-    </param>
-    <param>
-      <key>_enabled</key>
-      <value>True</value>
-    </param>
-    <param>
-      <key>type</key>
-      <value>fir_filter_ccf</value>
-    </param>
-    <param>
-      <key>decim</key>
-      <value>1</value>
-    </param>
-    <param>
-      <key>interp</key>
-      <value>1</value>
-    </param>
-    <param>
-      <key>gain</key>
-      <value>1</value>
-    </param>
-    <param>
-      <key>samp_rate</key>
-      <value>samp_rate_out</value>
-    </param>
-    <param>
-      <key>cutoff_freq</key>
-      <value>125e3</value>
-    </param>
-    <param>
-      <key>width</key>
-      <value>5e3</value>
-    </param>
-    <param>
-      <key>win</key>
-      <value>firdes.WIN_HAMMING</value>
-    </param>
-    <param>
-      <key>beta</key>
-      <value>6.76</value>
-    </param>
-    <param>
-      <key>alias</key>
+      <key>comment</key>
       <value></value>
     </param>
     <param>
@@ -303,75 +209,29 @@
       <value></value>
     </param>
     <param>
-      <key>minoutbuf</key>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(488, 217)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
       <value>0</value>
     </param>
     <param>
+      <key>id</key>
+      <value>fractional_resampler_xx_0</value>
+    </param>
+    <param>
       <key>maxoutbuf</key>
       <value>0</value>
     </param>
     <param>
-      <key>_coordinate</key>
-      <value>(704, 179)</value>
-    </param>
-    <param>
-      <key>_rotation</key>
+      <key>minoutbuf</key>
       <value>0</value>
     </param>
-  </block>
-  <block>
-    <key>pad_sink</key>
-    <param>
-      <key>id</key>
-      <value>pad_sink_0</value>
-    </param>
-    <param>
-      <key>_enabled</key>
-      <value>True</value>
-    </param>
-    <param>
-      <key>label</key>
-      <value>out</value>
-    </param>
-    <param>
-      <key>type</key>
-      <value>complex</value>
-    </param>
-    <param>
-      <key>vlen</key>
-      <value>1</value>
-    </param>
-    <param>
-      <key>num_streams</key>
-      <value>1</value>
-    </param>
-    <param>
-      <key>optional</key>
-      <value>False</value>
-    </param>
-    <param>
-      <key>_coordinate</key>
-      <value>(904, 227)</value>
-    </param>
-    <param>
-      <key>_rotation</key>
-      <value>0</value>
-    </param>
-  </block>
-  <block>
-    <key>fractional_resampler_xx</key>
-    <param>
-      <key>id</key>
-      <value>fractional_resampler_xx_0</value>
-    </param>
-    <param>
-      <key>_enabled</key>
-      <value>True</value>
-    </param>
-    <param>
-      <key>type</key>
-      <value>complex</value>
-    </param>
     <param>
       <key>phase_shift</key>
       <value>0</value>
@@ -381,118 +241,48 @@
       <value>samp_rate_in/samp_rate_out</value>
     </param>
     <param>
+      <key>type</key>
+      <value>complex</value>
+    </param>
+  </block>
+  <block>
+    <key>gsm_clock_offset_corrector_tagged</key>
+    <param>
       <key>alias</key>
       <value></value>
     </param>
     <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
       <key>affinity</key>
       <value></value>
     </param>
     <param>
-      <key>minoutbuf</key>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(224, 198)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
       <value>0</value>
     </param>
     <param>
+      <key>id</key>
+      <value>gsm_clock_offset_corrector_tagged_0</value>
+    </param>
+    <param>
       <key>maxoutbuf</key>
       <value>0</value>
     </param>
     <param>
-      <key>_coordinate</key>
-      <value>(488, 216)</value>
-    </param>
-    <param>
-      <key>_rotation</key>
+      <key>minoutbuf</key>
       <value>0</value>
     </param>
-  </block>
-  <block>
-    <key>pad_source</key>
-    <param>
-      <key>id</key>
-      <value>pad_source_0</value>
-    </param>
-    <param>
-      <key>_enabled</key>
-      <value>True</value>
-    </param>
-    <param>
-      <key>label</key>
-      <value>in</value>
-    </param>
-    <param>
-      <key>type</key>
-      <value>complex</value>
-    </param>
-    <param>
-      <key>vlen</key>
-      <value>1</value>
-    </param>
-    <param>
-      <key>num_streams</key>
-      <value>1</value>
-    </param>
-    <param>
-      <key>optional</key>
-      <value>False</value>
-    </param>
-    <param>
-      <key>_coordinate</key>
-      <value>(56, 179)</value>
-    </param>
-    <param>
-      <key>_rotation</key>
-      <value>0</value>
-    </param>
-  </block>
-  <block>
-    <key>pad_source</key>
-    <param>
-      <key>id</key>
-      <value>ppm_in</value>
-    </param>
-    <param>
-      <key>_enabled</key>
-      <value>True</value>
-    </param>
-    <param>
-      <key>label</key>
-      <value>ppm_in</value>
-    </param>
-    <param>
-      <key>type</key>
-      <value>message</value>
-    </param>
-    <param>
-      <key>vlen</key>
-      <value>1</value>
-    </param>
-    <param>
-      <key>num_streams</key>
-      <value>1</value>
-    </param>
-    <param>
-      <key>optional</key>
-      <value>True</value>
-    </param>
-    <param>
-      <key>_coordinate</key>
-      <value>(56, 243)</value>
-    </param>
-    <param>
-      <key>_rotation</key>
-      <value>0</value>
-    </param>
-  </block>
-  <block>
-    <key>gsm_clock_offset_corrector</key>
-    <param>
-      <key>id</key>
-      <value>gsm_clock_offset_corrector_0</value>
-    </param>
-    <param>
-      <key>_enabled</key>
-      <value>True</value>
-    </param>
     <param>
       <key>fc</key>
       <value>fc</value>
@@ -505,36 +295,302 @@
       <key>samp_rate_in</key>
       <value>samp_rate_in</value>
     </param>
+  </block>
+  <block>
+    <key>low_pass_filter</key>
+    <param>
+      <key>beta</key>
+      <value>6.76</value>
+    </param>
     <param>
       <key>alias</key>
       <value></value>
     </param>
     <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
       <key>affinity</key>
       <value></value>
     </param>
     <param>
-      <key>minoutbuf</key>
+      <key>cutoff_freq</key>
+      <value>125e3</value>
+    </param>
+    <param>
+      <key>decim</key>
+      <value>1</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>fir_filter_ccf</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(712, 186)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
       <value>0</value>
     </param>
     <param>
+      <key>gain</key>
+      <value>1</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>low_pass_filter_0_0</value>
+    </param>
+    <param>
+      <key>interp</key>
+      <value>1</value>
+    </param>
+    <param>
       <key>maxoutbuf</key>
       <value>0</value>
     </param>
     <param>
+      <key>minoutbuf</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>samp_rate</key>
+      <value>samp_rate_out</value>
+    </param>
+    <param>
+      <key>width</key>
+      <value>5e3</value>
+    </param>
+    <param>
+      <key>win</key>
+      <value>firdes.WIN_HAMMING</value>
+    </param>
+  </block>
+  <block>
+    <key>parameter</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
       <key>_coordinate</key>
-      <value>(280, 195)</value>
+      <value>(541, 23)</value>
     </param>
     <param>
       <key>_rotation</key>
       <value>0</value>
     </param>
+    <param>
+      <key>id</key>
+      <value>osr</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>OSR</value>
+    </param>
+    <param>
+      <key>short_id</key>
+      <value></value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>intx</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>4</value>
+    </param>
+  </block>
+  <block>
+    <key>pad_sink</key>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(904, 228)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>pad_sink_0</value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>complex</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>out</value>
+    </param>
+    <param>
+      <key>num_streams</key>
+      <value>1</value>
+    </param>
+    <param>
+      <key>optional</key>
+      <value>False</value>
+    </param>
+    <param>
+      <key>vlen</key>
+      <value>1</value>
+    </param>
+  </block>
+  <block>
+    <key>pad_source</key>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(56, 236)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>pad_source_0</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>in</value>
+    </param>
+    <param>
+      <key>num_streams</key>
+      <value>1</value>
+    </param>
+    <param>
+      <key>optional</key>
+      <value>False</value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>complex</value>
+    </param>
+    <param>
+      <key>vlen</key>
+      <value>1</value>
+    </param>
+  </block>
+  <block>
+    <key>parameter</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(453, 22)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>ppm</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>ppm</value>
+    </param>
+    <param>
+      <key>short_id</key>
+      <value></value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>eng_float</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>parameter</key>
+    <param>
+      <key>alias</key>
+      <value></value>
+    </param>
+    <param>
+      <key>comment</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(328, 22)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>samp_rate_in</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>samp_rate_in</value>
+    </param>
+    <param>
+      <key>short_id</key>
+      <value></value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>eng_float</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>1e6</value>
+    </param>
   </block>
   <connection>
-    <source_block_id>low_pass_filter_0_0</source_block_id>
-    <sink_block_id>pad_sink_0</sink_block_id>
-    <source_key>0</source_key>
-    <sink_key>0</sink_key>
+    <source_block_id>ctrl_in</source_block_id>
+    <sink_block_id>gsm_clock_offset_corrector_tagged_0</sink_block_id>
+    <source_key>out</source_key>
+    <sink_key>ctrl</sink_key>
   </connection>
   <connection>
     <source_block_id>fractional_resampler_xx_0</source_block_id>
@@ -543,21 +599,21 @@
     <sink_key>0</sink_key>
   </connection>
   <connection>
-    <source_block_id>gsm_clock_offset_corrector_0</source_block_id>
+    <source_block_id>gsm_clock_offset_corrector_tagged_0</source_block_id>
     <sink_block_id>fractional_resampler_xx_0</sink_block_id>
     <source_key>0</source_key>
     <sink_key>0</sink_key>
   </connection>
   <connection>
-    <source_block_id>pad_source_0</source_block_id>
-    <sink_block_id>gsm_clock_offset_corrector_0</sink_block_id>
+    <source_block_id>low_pass_filter_0_0</source_block_id>
+    <sink_block_id>pad_sink_0</sink_block_id>
     <source_key>0</source_key>
     <sink_key>0</sink_key>
   </connection>
   <connection>
-    <source_block_id>ppm_in</source_block_id>
-    <sink_block_id>gsm_clock_offset_corrector_0</sink_block_id>
+    <source_block_id>pad_source_0</source_block_id>
+    <sink_block_id>gsm_clock_offset_corrector_tagged_0</sink_block_id>
     <source_key>0</source_key>
-    <sink_key>ppm_in</sink_key>
+    <sink_key>0</sink_key>
   </connection>
 </flow_graph>
diff --git a/include/grgsm/CMakeLists.txt b/include/grgsm/CMakeLists.txt
index 50788ae..210320a 100644
--- a/include/grgsm/CMakeLists.txt
+++ b/include/grgsm/CMakeLists.txt
@@ -24,7 +24,8 @@
     plotting.hpp
     api.h
     gsmtap.h
-    msg_to_tag.h DESTINATION include/grgsm
+    msg_to_tag.h
+    controlled_fractional_resampler_cc.h DESTINATION include/grgsm
 )
 
 add_subdirectory(decoding)
diff --git a/include/grgsm/controlled_fractional_resampler_cc.h b/include/grgsm/controlled_fractional_resampler_cc.h
new file mode 100644
index 0000000..9eeb393
--- /dev/null
+++ b/include/grgsm/controlled_fractional_resampler_cc.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/* @file
+ * @author Piotr Krysik <ptrkrysik@gmail.com>
+ * @section LICENSE
+ * 
+ * Gr-gsm is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * Gr-gsm is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with gr-gsm; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ * 
+ */
+
+
+#ifndef INCLUDED_GRGSM_CONTROLLED_FRACTIONAL_RESAMPLER_CC_H
+#define INCLUDED_GRGSM_CONTROLLED_FRACTIONAL_RESAMPLER_CC_H
+
+#include <grgsm/api.h>
+#include <gnuradio/block.h>
+//#include <gnuradio/filter/fractional_resampler_cc.h>
+
+namespace gr {
+  namespace gsm {
+
+    /*!
+     * \brief <+description of block+>
+     * \ingroup grgsm
+     *
+     */
+    class GRGSM_API controlled_fractional_resampler_cc :  virtual public block
+    {
+     public:
+      typedef boost::shared_ptr<controlled_fractional_resampler_cc> sptr;
+
+      /*!
+       * \brief Return a shared_ptr to a new instance of grgsm::controlled_fractional_resampler_cc.
+       *
+       * To avoid accidental use of raw pointers, grgsm::controlled_fractional_resampler_cc's
+       * constructor is in a private implementation
+       * class. grgsm::controlled_fractional_resampler_cc::make is the public interface for
+       * creating new instances.
+       */
+      static sptr make(float phase_shift, float resamp_ratio);
+      
+      virtual float mu() const = 0;
+      virtual float resamp_ratio() const = 0;
+      virtual void set_mu (float mu) = 0;
+      virtual void set_resamp_ratio(float resamp_ratio) = 0;
+    };
+
+  } // namespace grgsm
+} // namespace gr
+
+#endif /* INCLUDED_GRGSM_CONTROLLED_FRACTIONAL_RESAMPLER_CC_H */
+
diff --git a/include/grgsm/decoding/tch_f_decoder.h b/include/grgsm/decoding/tch_f_decoder.h
index 18a1baa..93fe971 100644
--- a/include/grgsm/decoding/tch_f_decoder.h
+++ b/include/grgsm/decoding/tch_f_decoder.h
@@ -62,7 +62,7 @@
        * class. gsm::tch_f_decoder::make is the public interface for
        * creating new instances.
        */
-      static sptr make(tch_mode mode, const std::string &file, bool boundary_check=true);
+      static sptr make(tch_mode mode, bool boundary_check=false);
 
     };
 
diff --git a/include/grgsm/msg_to_tag.h b/include/grgsm/msg_to_tag.h
index 3d63460..69232fc 100644
--- a/include/grgsm/msg_to_tag.h
+++ b/include/grgsm/msg_to_tag.h
@@ -28,7 +28,7 @@
 #include <gnuradio/sync_block.h>
 
 namespace gr {
-  namespace grgsm {
+  namespace gsm {
 
     /*!
      * \brief <+description of block+>
@@ -39,7 +39,6 @@
     {
      public:
       typedef boost::shared_ptr<msg_to_tag> sptr;
-
       /*!
        * \brief Return a shared_ptr to a new instance of grgsm::msg_to_tag.
        *
diff --git a/include/grgsm/receiver/clock_offset_control.h b/include/grgsm/receiver/clock_offset_control.h
index 9a96d9c..ef750d1 100644
--- a/include/grgsm/receiver/clock_offset_control.h
+++ b/include/grgsm/receiver/clock_offset_control.h
@@ -49,8 +49,9 @@
        * class. gsm::clock_offset_control::make is the public interface for
        * creating new instances.
        */
-      static sptr make(float fc);
-      virtual void set_fc(float fc) = 0;      
+      static sptr make(float fc, float samp_rate);
+      virtual void set_fc(float fc) = 0;  
+      virtual void set_samp_rate(float samp_rate) = 0;    
     };
    
   } // namespace gsm
diff --git a/include/grgsm/receiver/receiver.h b/include/grgsm/receiver/receiver.h
index 97297ca..e19fe7a 100644
--- a/include/grgsm/receiver/receiver.h
+++ b/include/grgsm/receiver/receiver.h
@@ -26,7 +26,6 @@
 
 #include <grgsm/api.h>
 #include <gnuradio/block.h>
-#include <gnuradio/feval.h>
 #include <gnuradio/sync_block.h>
 #include <vector>
 
diff --git a/installer-packages/.placeholder b/installer-packages/.placeholder
deleted file mode 100644
index e69de29..0000000
--- a/installer-packages/.placeholder
+++ /dev/null
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 3ce05f8..35195e0 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -31,9 +31,6 @@
     receiver/sch.c
     receiver/clock_offset_control_impl.cc
     receiver/cx_channel_hopper_impl.cc
-    misc_utils/bursts_printer_impl.cc
-    misc_utils/extract_system_info_impl.cc
-    misc_utils/extract_immediate_assignment_impl.cc
     demapping/universal_ctrl_chans_demapper_impl.cc
     demapping/tch_f_chans_demapper_impl.cc
     decoding/control_channels_decoder_impl.cc
@@ -54,23 +51,27 @@
     flow_control/dummy_burst_filter_impl.cc
     misc_utils/controlled_rotator_cc_impl.cc
     misc_utils/controlled_const_source_f_impl.cc
+    misc_utils/controlled_fractional_resampler_cc_impl.cc
+    misc_utils/msg_to_tag_impl.cc
     misc_utils/message_printer_impl.cc
     misc_utils/tmsi_dumper_impl.cc
     misc_utils/burst_file_sink_impl.cc
     misc_utils/burst_file_source_impl.cc
     misc_utils/message_file_sink_impl.cc
-    misc_utils/message_file_source_impl.cc   
+    misc_utils/message_file_source_impl.cc
+    misc_utils/bursts_printer_impl.cc
+    misc_utils/extract_system_info_impl.cc
+    misc_utils/extract_immediate_assignment_impl.cc
     qa_utils/burst_sink_impl.cc
     qa_utils/burst_source_impl.cc
     qa_utils/message_source_impl.cc
     qa_utils/message_sink_impl.cc
     decryption/decryption_impl.cc
-    msg_to_tag_impl.cc
 )
 
 
 add_library(grgsm SHARED ${grgsm_sources})
-target_link_libraries(grgsm ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${VOLK_LIBRARIES} ${LIBOSMOCORE_LIBRARIES}
+target_link_libraries(grgsm ${Boost_LIBRARIES} ${GNURADIO_ALL_LIBRARIES} ${VOLK_LIBRARIES} ${LIBOSMOCORE_LIBRARIES}
 # libraries required by plotting.h - have troubles to be installed by pybombs
 #    boost_iostreams
 #    boost_system
diff --git a/lib/decoding/tch_f_decoder_impl.cc b/lib/decoding/tch_f_decoder_impl.cc
index f409d37..cc88c90 100644
--- a/lib/decoding/tch_f_decoder_impl.cc
+++ b/lib/decoding/tch_f_decoder_impl.cc
@@ -35,16 +35,16 @@
   namespace gsm {
 
     tch_f_decoder::sptr
-    tch_f_decoder::make(tch_mode mode, const std::string &file, bool boundary_check)
+    tch_f_decoder::make(tch_mode mode, bool boundary_check)
     {
       return gnuradio::get_initial_sptr
-        (new tch_f_decoder_impl(mode, file, boundary_check));
+        (new tch_f_decoder_impl(mode, boundary_check));
     }
 
     /*
      * Constructor
      */
-    tch_f_decoder_impl::tch_f_decoder_impl(tch_mode mode, const std::string &file, bool boundary_check)
+    tch_f_decoder_impl::tch_f_decoder_impl(tch_mode mode, bool boundary_check)
       : gr::block("tch_f_decoder",
               gr::io_signature::make(0, 0, 0),
               gr::io_signature::make(0, 0, 0)),
@@ -52,6 +52,7 @@
       d_collected_bursts_num(0),
       d_boundary_check(boundary_check),
       d_boundary_decode(!boundary_check),
+      d_header_sent(false),
       mBlockCoder(0x10004820009ULL, 40, 224),
       mU(228),
       mP(mU.segment(184,40)),
@@ -65,18 +66,11 @@
       mClass1A_d(mTCHD.head(50)),
       mTCHParity(0x0b, 3, 50)
     {
-        d_speech_file = fopen( file.c_str(), "wb" );
-        if (d_speech_file == NULL)
-        {
-            throw std::runtime_error("TCH/F Decoder: can't open file\n");
-        }
-
-        const unsigned char amr_nb_magic[6] = { 0x23, 0x21, 0x41, 0x4d, 0x52, 0x0a };
-
-        if (d_tch_mode != TCH_FS)
-        {
-            fwrite(amr_nb_magic, 1, 6, d_speech_file);
-        }
+        //setup input/output ports
+        message_port_register_in(pmt::mp("bursts"));
+        set_msg_handler(pmt::mp("bursts"), boost::bind(&tch_f_decoder_impl::decode, this, _1));
+        message_port_register_out(pmt::mp("msgs"));
+        message_port_register_out(pmt::mp("voice"));    
 
         int j, k, B;
         for (k = 0; k < CONV_SIZE; k++)
@@ -86,11 +80,6 @@
             interleave_trans[k] = B * 114 + j;
         }
 
-        //setup input/output ports
-        message_port_register_in(pmt::mp("bursts"));
-        set_msg_handler(pmt::mp("bursts"), boost::bind(&tch_f_decoder_impl::decode, this, _1));
-        message_port_register_out(pmt::mp("msgs"));
-
         setCodingMode(mode);
     }
 
@@ -100,9 +89,20 @@
 
     void tch_f_decoder_impl::decode(pmt::pmt_t msg)
     {
+        if(!d_header_sent)
+        {
+            if (d_tch_mode != TCH_FS)
+            {
+                const unsigned char amr_nb_magic[7] = "#!AMR\n";
+                message_port_pub(pmt::mp("voice"), pmt::cons(pmt::PMT_NIL, pmt::make_blob(amr_nb_magic,6)));
+            }
+            d_header_sent = true;
+        }
+
+
         d_bursts[d_collected_bursts_num] = msg;
         d_collected_bursts_num++;
-
+        
         bool stolen = false;
 
         if (d_collected_bursts_num == 8)
@@ -249,7 +249,7 @@
                 return;
             }
 
-            // Decode voice frames and write to file
+            // Decode voice frames and send to the output
             if (d_tch_mode == TCH_FS || d_tch_mode == TCH_EFR)
             {
                 mVR204Coder.decode(mClass1_c, mTCHU);
@@ -329,7 +329,7 @@
                         amrFrame.pack(frameBuffer);
 
                     }
-                    fwrite(frameBuffer, 1 , mTCHFrameLength, d_speech_file);
+                    message_port_pub(pmt::mp("voice"), pmt::cons(pmt::PMT_NIL, pmt::make_blob(frameBuffer,mTCHFrameLength)));
                 }
             }
             else
@@ -378,7 +378,7 @@
                     // mTCHD.unmap(mAMRBitOrder, payload.size(), payload);
                     mTCHD.copyTo(payload);
                     amrFrame.pack(frameBuffer);
-                    fwrite(frameBuffer, 1 , mAMRFrameLth, d_speech_file);
+                    message_port_pub(pmt::mp("voice"), pmt::cons(pmt::PMT_NIL, pmt::make_blob(frameBuffer,mAMRFrameLth)));
                 }
             }
         }
diff --git a/lib/decoding/tch_f_decoder_impl.h b/lib/decoding/tch_f_decoder_impl.h
index 3e8c79a..0119b5a 100644
--- a/lib/decoding/tch_f_decoder_impl.h
+++ b/lib/decoding/tch_f_decoder_impl.h
@@ -52,10 +52,10 @@
                 unsigned int d_collected_bursts_num;
                 unsigned short interleave_trans[CONV_SIZE];
                 pmt::pmt_t d_bursts[8];
-                FILE * d_speech_file;
                 enum tch_mode d_tch_mode;
                 bool d_boundary_check;
                 bool d_boundary_decode;
+                bool d_header_sent;
 
                 BitVector mU;
                 BitVector mP;
@@ -89,7 +89,7 @@
                 void decode(pmt::pmt_t msg);
                 void setCodingMode(tch_mode mode);
             public:
-                tch_f_decoder_impl(tch_mode mode, const std::string &file, bool boundary_check=true);
+                tch_f_decoder_impl(tch_mode mode, bool boundary_check=false);
                 ~tch_f_decoder_impl();
         };
 
diff --git a/lib/misc_utils/controlled_fractional_resampler_cc_impl.cc b/lib/misc_utils/controlled_fractional_resampler_cc_impl.cc
new file mode 100644
index 0000000..cf15a04
--- /dev/null
+++ b/lib/misc_utils/controlled_fractional_resampler_cc_impl.cc
@@ -0,0 +1,182 @@
+/* -*- c++ -*- */
+/* @file
+ * @author Piotr Krysik <ptrkrysik@gmail.com>
+ * @section LICENSE
+ * 
+ * Gr-gsm is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * Gr-gsm is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with gr-gsm; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ * 
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gnuradio/io_signature.h>
+#include "controlled_fractional_resampler_cc_impl.h"
+#include <stdexcept>
+
+namespace gr {
+  namespace gsm {
+
+    controlled_fractional_resampler_cc::sptr
+    controlled_fractional_resampler_cc::make(float phase_shift, float resamp_ratio)
+    {
+      return gnuradio::get_initial_sptr
+        (new controlled_fractional_resampler_cc_impl(phase_shift, resamp_ratio));
+    }
+
+    controlled_fractional_resampler_cc_impl::controlled_fractional_resampler_cc_impl
+                                     (float phase_shift, float resamp_ratio)
+      : block("controlled_fractional_resampler_cc",
+              io_signature::make(1, 1, sizeof(gr_complex)),
+              io_signature::make(1, 1, sizeof(gr_complex))),
+        d_mu(phase_shift), d_mu_inc(resamp_ratio),
+        d_resamp(new mmse_fir_interpolator_cc())
+    {
+      this->set_tag_propagation_policy(TPP_DONT);
+      if(resamp_ratio <=  0)
+        throw std::out_of_range("resampling ratio must be > 0");
+      if(phase_shift <  0  || phase_shift > 1)
+        throw std::out_of_range("phase shift ratio must be > 0 and < 1");
+
+      set_relative_rate(1.0 / resamp_ratio);
+    }
+
+    controlled_fractional_resampler_cc_impl::~controlled_fractional_resampler_cc_impl()
+    {
+      delete d_resamp;
+    }
+
+    void
+    controlled_fractional_resampler_cc_impl::forecast(int noutput_items,
+                                           gr_vector_int &ninput_items_required)
+    {
+      unsigned ninputs = ninput_items_required.size();
+      for(unsigned i=0; i < ninputs; i++) {
+        ninput_items_required[i] =
+          (int)ceil((noutput_items * d_mu_inc) + d_resamp->ntaps());
+      }
+    }
+
+    int
+    controlled_fractional_resampler_cc_impl::general_work(int noutput_items,
+                                               gr_vector_int &ninput_items,
+                                               gr_vector_const_void_star &input_items,
+                                               gr_vector_void_star &output_items)
+    {
+      const gr_complex *in = (const gr_complex*)input_items[0];
+      gr_complex *out = (gr_complex*)output_items[0];
+      
+      uint64_t processed_in = 0; //input samples processed in the last call to resample function
+      uint64_t processed_in_sum = 0; //input samples processed during a whole call to general_work function
+      uint64_t produced_out_sum = 0; //output samples produced during a whole call to general_work function
+
+      std::vector<tag_t> set_resamp_ratio_tags;
+
+      pmt::pmt_t key = pmt::string_to_symbol("set_resamp_ratio");
+      get_tags_in_window(set_resamp_ratio_tags, 0, 0, ninput_items[0]);
+      
+      bool all_output_samples_produced = false;
+      for(std::vector<tag_t>::iterator i_tag = set_resamp_ratio_tags.begin(); i_tag < set_resamp_ratio_tags.end(); i_tag++)
+      {
+        uint64_t tag_offset_rel = i_tag->offset - nitems_read(0);
+        
+        if(pmt::symbol_to_string(i_tag->key) == "set_resamp_ratio")
+        {
+          uint64_t samples_to_produce = static_cast<uint64_t>(round(static_cast<double>(tag_offset_rel-processed_in_sum)/d_mu_inc)); //tu może być problem - bo to jest gÅ‚upota przy d_mu_inc różnym od 1.0
+          
+          if( (samples_to_produce + produced_out_sum) > noutput_items)
+          {
+            samples_to_produce = noutput_items - produced_out_sum;
+            all_output_samples_produced = true;
+          }
+          
+          processed_in = resample(in, processed_in_sum, out, produced_out_sum, samples_to_produce);
+          processed_in_sum = processed_in_sum + processed_in;
+          produced_out_sum = produced_out_sum + samples_to_produce;
+
+          if(all_output_samples_produced)
+          {
+            break;
+          } else {
+              add_item_tag(0, produced_out_sum + nitems_written(0), i_tag->key, i_tag->value);                       
+              set_resamp_ratio(pmt::to_double(i_tag->value));
+          }
+        } else {
+          uint64_t out_samples_to_tag = round(static_cast<double>(tag_offset_rel-processed_in_sum)/d_mu_inc);
+          if( (out_samples_to_tag + produced_out_sum) <= noutput_items)
+          {
+            add_item_tag(0, produced_out_sum + out_samples_to_tag + nitems_written(0), i_tag->key, i_tag->value);
+          }
+        }
+      }
+
+      if(!all_output_samples_produced)
+      {
+        processed_in = resample(in, processed_in_sum, out, produced_out_sum, (noutput_items-produced_out_sum));
+        processed_in_sum = processed_in_sum + processed_in;
+      }
+      
+      consume_each(processed_in_sum);
+      return noutput_items;
+    }
+    
+    inline uint64_t 
+    controlled_fractional_resampler_cc_impl::resample(const gr_complex *in, uint64_t first_in_sample, gr_complex *out, uint64_t first_out_sample, uint64_t samples_to_produce)
+    {
+      int ii = first_in_sample;
+      int oo = first_out_sample;
+      while(oo < (first_out_sample+samples_to_produce)) //produce samples_to_produce number of samples
+      {
+        out[oo++] = d_resamp->interpolate(&in[ii], d_mu);
+      
+        double s = d_mu + d_mu_inc;
+        double f = floor(s);
+        int incr = (int)f;
+        d_mu = s - f;
+        ii += incr;
+      }
+      return ii-first_in_sample; //number of input samples processed
+    }
+
+    float
+    controlled_fractional_resampler_cc_impl::mu() const
+    {
+      return d_mu;
+    }
+
+    float
+    controlled_fractional_resampler_cc_impl::resamp_ratio() const
+    {
+      return d_mu_inc;
+    }
+
+    void
+    controlled_fractional_resampler_cc_impl::set_mu(float mu)
+    {
+      d_mu = mu;
+    }
+
+    void
+    controlled_fractional_resampler_cc_impl::set_resamp_ratio(float resamp_ratio)
+    {
+      d_mu_inc = resamp_ratio;
+      set_relative_rate(1.0 / resamp_ratio);
+    }
+
+  } /* namespace grgsm */
+} /* namespace gr */
+
diff --git a/lib/misc_utils/controlled_fractional_resampler_cc_impl.h b/lib/misc_utils/controlled_fractional_resampler_cc_impl.h
new file mode 100644
index 0000000..dab8a0b
--- /dev/null
+++ b/lib/misc_utils/controlled_fractional_resampler_cc_impl.h
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/* @file
+ * @author Piotr Krysik <ptrkrysik@gmail.com>
+ * @section LICENSE
+ * 
+ * Gr-gsm is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * Gr-gsm is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with gr-gsm; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ * 
+ */
+
+#ifndef INCLUDED_GRGSM_CONTROLLED_FRACTIONAL_RESAMPLER_CC_IMPL_H
+#define INCLUDED_GRGSM_CONTROLLED_FRACTIONAL_RESAMPLER_CC_IMPL_H
+
+#include <grgsm/controlled_fractional_resampler_cc.h>
+//#include <gnuradio/filter/fractional_resampler_cc.h>
+#include <gnuradio/filter/mmse_fir_interpolator_cc.h>
+
+using namespace gr::filter;
+
+namespace gr {
+  namespace gsm {
+
+    class controlled_fractional_resampler_cc_impl : public controlled_fractional_resampler_cc
+    {
+    private:
+      float d_mu;
+      float d_mu_inc;
+      mmse_fir_interpolator_cc *d_resamp;
+      
+      inline uint64_t resample(const gr_complex *in, 
+           uint64_t first_in_sample, 
+           gr_complex *out, 
+           uint64_t first_out_sample, 
+           uint64_t samples_to_produce);
+                                               
+    public:
+      controlled_fractional_resampler_cc_impl(float phase_shift,
+                                   float resamp_ratio);
+      ~controlled_fractional_resampler_cc_impl();
+
+      void forecast(int noutput_items,
+		       gr_vector_int &ninput_items_required);
+
+      int general_work(int noutput_items,
+		       gr_vector_int &ninput_items,
+		       gr_vector_const_void_star &input_items,
+		       gr_vector_void_star &output_items);
+
+
+      float mu() const;
+      float resamp_ratio() const;
+      void set_mu(float mu);
+      void set_resamp_ratio(float resamp_ratio);
+    };
+
+  } // namespace grgsm
+} // namespace gr
+
+#endif /* INCLUDED_GRGSM_CONTROLLED_FRACTIONAL_RESAMPLER_CC_IMPL_H */
+
diff --git a/lib/misc_utils/controlled_rotator_cc_impl.cc b/lib/misc_utils/controlled_rotator_cc_impl.cc
index 6211d49..68fa207 100644
--- a/lib/misc_utils/controlled_rotator_cc_impl.cc
+++ b/lib/misc_utils/controlled_rotator_cc_impl.cc
@@ -74,10 +74,8 @@
     controlled_rotator_cc_impl::work(int noutput_items,
 			  gr_vector_const_void_star &input_items,
 			  gr_vector_void_star &output_items)
-    {
-      const gr_complex *in = (const gr_complex *)input_items[0];
-      gr_complex *out = (gr_complex *)output_items[0];
-
+		{
+		  //process phase_inc input
       if(input_items.size() == 2) {
         int ii=0;
         const float *pp = (const float *)input_items[1];
@@ -101,10 +99,38 @@
           ii++;
         }
       }
-      d_r.rotateN(out, const_cast<gr_complex *>(in), noutput_items); //const_cast<gr_complex *> is workaround old implementation of rotateN that is still present in ubuntu 14.04 packages
-      return noutput_items;
-    }
+      		
+      //get complex input and output
+      const gr_complex *in = (const gr_complex *)input_items[0];
+      gr_complex *out = (gr_complex *)output_items[0];
+		  //get tags
 
+      uint64_t processed_in = 0;
+      uint64_t produced_out = 0;
+
+      std::vector<tag_t> set_phase_inc_tags;
+
+      pmt::pmt_t key = pmt::string_to_symbol("set_phase_inc");
+      get_tags_in_window(set_phase_inc_tags, 0, 0, noutput_items, key);
+      
+      for(std::vector<tag_t>::iterator i_tag = set_phase_inc_tags.begin(); i_tag < set_phase_inc_tags.end(); i_tag++){
+        uint64_t tag_offset_rel = i_tag->offset-nitems_read(0);
+        set_phase_inc(pmt::to_double(i_tag->value));
+        uint64_t samples_to_process = tag_offset_rel-processed_in;
+        d_r.rotateN((out+produced_out), const_cast<gr_complex *>(in+processed_in), samples_to_process);
+        processed_in = processed_in + samples_to_process;
+        produced_out = produced_out + samples_to_process;
+//        std::cout << "Rotator, phase inc: " << pmt::to_double(i_tag->value) << std::endl;
+        
+        float freq_offset_setting = (pmt::to_double(i_tag->value) / (2*M_PI)) * d_samp_rate; //send stream tag with a new value of the frequency offset
+        pmt::pmt_t key = pmt::string_to_symbol("setting_freq_offset");
+        pmt::pmt_t value =  pmt::from_double(freq_offset_setting);
+        add_item_tag(0,i_tag->offset, key, value);
+      }
+      
+      d_r.rotateN((out+produced_out), const_cast<gr_complex *>(in+processed_in), (noutput_items-produced_out)); //const_cast<gr_complex *> is workaround old implementation of rotateN that is still present in ubuntu 14.04 packages
+      return noutput_items;
+		}
   } /* namespace gsm */
 } /* namespace gr */
 
diff --git a/lib/misc_utils/controlled_rotator_cc_impl.h b/lib/misc_utils/controlled_rotator_cc_impl.h
index 14064cb..45c5af9 100644
--- a/lib/misc_utils/controlled_rotator_cc_impl.h
+++ b/lib/misc_utils/controlled_rotator_cc_impl.h
@@ -42,6 +42,7 @@
 
       virtual void set_phase_inc(double phase_inc);
       virtual void set_samp_rate(double samp_rate);
+
       // Where all the action really happens
       int work(int noutput_items,
 	       gr_vector_const_void_star &input_items,
diff --git a/lib/misc_utils/msg_to_tag_impl.cc b/lib/misc_utils/msg_to_tag_impl.cc
new file mode 100644
index 0000000..e572864
--- /dev/null
+++ b/lib/misc_utils/msg_to_tag_impl.cc
@@ -0,0 +1,99 @@
+/* -*- c++ -*- */
+/* @file
+ * @author Piotr Krysik <ptrkrysik@gmail.com>
+ * @section LICENSE
+ * 
+ * Gr-gsm is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * Gr-gsm is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with gr-gsm; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ * 
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gnuradio/io_signature.h>
+#include "msg_to_tag_impl.h"
+
+namespace gr {
+  namespace gsm {
+
+    msg_to_tag::sptr
+    msg_to_tag::make()
+    {
+      return gnuradio::get_initial_sptr
+        (new msg_to_tag_impl());
+    }
+
+    void msg_to_tag_impl::queue_msg(pmt::pmt_t msg){
+      if(pmt::is_dict(msg)){
+        try {
+          pmt::pmt_t keys = pmt::dict_keys(msg);
+        } catch (const pmt::wrong_type &e) {
+          msg = pmt::dict_add(pmt::make_dict(), pmt::car(msg), pmt::cdr(msg));
+        }
+      }
+      d_msg_queue.push_back(msg);
+    }
+
+    /*
+     * The private constructor
+     */
+    msg_to_tag_impl::msg_to_tag_impl()
+      : gr::sync_block("msg_to_tag",
+              gr::io_signature::make(1, 1, sizeof(gr_complex)),
+              gr::io_signature::make(1, 1, sizeof(gr_complex)))              
+    {
+      message_port_register_in(pmt::mp("msg"));
+      set_msg_handler(pmt::mp("msg"), boost::bind(&msg_to_tag_impl::queue_msg, this, _1));
+    }
+
+    /*
+     * Our virtual destructor.
+     */
+    msg_to_tag_impl::~msg_to_tag_impl()
+    {
+    }
+
+    int
+    msg_to_tag_impl::work(int noutput_items,
+        gr_vector_const_void_star &input_items,
+        gr_vector_void_star &output_items)
+    {
+      while(!d_msg_queue.empty()){
+        pmt::pmt_t msg(d_msg_queue.front());
+        d_msg_queue.pop_front();
+        if(pmt::is_dict(msg)){
+          pmt::pmt_t klist(pmt::dict_keys(msg));
+          for (size_t i = 0; i < pmt::length(klist); i++) {
+            pmt::pmt_t k(pmt::nth(i, klist));
+            pmt::pmt_t v(pmt::dict_ref(msg, k, pmt::PMT_NIL));
+            add_item_tag(0, nitems_written(0), k, v, alias_pmt());
+          }
+        } else if(pmt::is_number(msg)) {
+          add_item_tag(0, nitems_written(0), pmt::intern(""), msg, alias_pmt());
+        } else if(pmt::is_symbol(msg)) {
+          add_item_tag(0, nitems_written(0), msg, pmt::intern(""), alias_pmt());
+        }        
+      }
+
+      memcpy(output_items[0], input_items[0], sizeof(gr_complex)*noutput_items);
+      // Tell runtime system how many output items we produced.
+      return noutput_items;
+    }
+
+  } /* namespace grgsm */
+} /* namespace gr */
+
diff --git a/lib/msg_to_tag_impl.h b/lib/misc_utils/msg_to_tag_impl.h
similarity index 92%
rename from lib/msg_to_tag_impl.h
rename to lib/misc_utils/msg_to_tag_impl.h
index e761d3e..77d03d0 100644
--- a/lib/msg_to_tag_impl.h
+++ b/lib/misc_utils/msg_to_tag_impl.h
@@ -26,16 +26,17 @@
 #include <grgsm/msg_to_tag.h>
 
 namespace gr {
-  namespace grgsm {
+  namespace gsm {
 
     class msg_to_tag_impl : public msg_to_tag
     {
      private:
-      // Nothing to declare in this block.
+        std::deque<pmt::pmt_t> d_msg_queue;
 
      public:
       msg_to_tag_impl();
       ~msg_to_tag_impl();
+      void queue_msg(pmt::pmt_t msg);
 
       // Where all the action really happens
       int work(int noutput_items,
diff --git a/lib/msg_to_tag_impl.cc b/lib/msg_to_tag_impl.cc
deleted file mode 100644
index eb0fc13..0000000
--- a/lib/msg_to_tag_impl.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- c++ -*- */
-/* @file
- * @author Piotr Krysik <ptrkrysik@gmail.com>
- * @section LICENSE
- * 
- * Gr-gsm is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * Gr-gsm is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with gr-gsm; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- * 
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gnuradio/io_signature.h>
-//#include <gnuradio/msg_queue.h>
-#include "msg_to_tag_impl.h"
-
-namespace gr {
-  namespace grgsm {
-
-    msg_to_tag::sptr
-    msg_to_tag::make()
-    {
-      return gnuradio::get_initial_sptr
-        (new msg_to_tag_impl());
-    }
-
-//    void msg_to_tag_impl::queue_msg(pmt::pmt_t msg){
-//        
-//    }
-
-    /*
-     * The private constructor
-     */
-    msg_to_tag_impl::msg_to_tag_impl()
-      : gr::sync_block("msg_to_tag",
-              gr::io_signature::make(1, 1, sizeof(gr_complex)),
-              gr::io_signature::make(1, 1, sizeof(gr_complex)))
-    {
-        message_port_register_in(pmt::mp("msg"));
-//        set_msg_handler(pmt::mp("msg"), boost::bind(&msg_to_tag::queue_msg, this, _1));
-    }
-
-    /*
-     * Our virtual destructor.
-     */
-    msg_to_tag_impl::~msg_to_tag_impl()
-    {
-    }
-
-    int
-    msg_to_tag_impl::work(int noutput_items,
-        gr_vector_const_void_star &input_items,
-        gr_vector_void_star &output_items)
-    {
-      const gr_complex *in = (const gr_complex *) input_items[0];
-      gr_complex *out = (gr_complex *) output_items[0];
-
-      // Do <+signal processing+>
-      memcpy(out, in, sizeof(gr_complex)*noutput_items);
-      // Tell runtime system how many output items we produced.
-      return noutput_items;
-    }
-
-  } /* namespace grgsm */
-} /* namespace gr */
-
diff --git a/lib/receiver/clock_offset_control_impl.cc b/lib/receiver/clock_offset_control_impl.cc
index 43a9b8e..b3a7934 100644
--- a/lib/receiver/clock_offset_control_impl.cc
+++ b/lib/receiver/clock_offset_control_impl.cc
@@ -33,17 +33,17 @@
 namespace gsm
 {
 clock_offset_control::sptr
-clock_offset_control::make(float fc)
+clock_offset_control::make(float fc, float samp_rate)
 {
     return gnuradio::get_initial_sptr
-           (new clock_offset_control_impl(fc));
+           (new clock_offset_control_impl(fc, samp_rate));
 }
 
 
 /*
  * The private constructor
  */
-clock_offset_control_impl::clock_offset_control_impl(float fc)
+clock_offset_control_impl::clock_offset_control_impl(float fc, float samp_rate)
     : gr::block("clock_offset_control",
                 gr::io_signature::make(0, 0, 0),
                 gr::io_signature::make(0, 0, 0))
@@ -51,9 +51,10 @@
 {
     message_port_register_in(pmt::mp("measurements"));
     set_msg_handler(pmt::mp("measurements"), boost::bind(&clock_offset_control_impl::process_measurement, this, _1));    
-    message_port_register_out(pmt::mp("ppm"));
+    message_port_register_out(pmt::mp("ctrl"));
     
     set_fc(fc);
+    set_samp_rate(samp_rate);
     d_alfa = 0.3;
     d_ppm_estimate = -1e6;
     d_last_ppm_estimate = -1e6;    
@@ -77,6 +78,11 @@
     d_fc = fc;
 }
 
+void clock_offset_control_impl::set_samp_rate(float samp_rate)
+{
+    d_samp_rate = samp_rate;
+}
+
 void clock_offset_control_impl::process_measurement(pmt::pmt_t msg)
 {
     if(pmt::is_tuple(msg))
@@ -103,66 +109,76 @@
             float ppm = -freq_offset/d_fc*1.0e6;
             std::string state = pmt::symbol_to_string(pmt::tuple_ref(msg,2));
             d_last_state = state;
-            if(std::abs(ppm) > 100.0) //safeguard against flawed measurements
+            if(std::abs(ppm) < 100.0) //safeguard against flawed measurements
             {
-                ppm=0;
-                reset();
-            }
 
-            if(state == "fcch_search")
-            {
-                pmt::pmt_t msg_ppm = pmt::from_double(ppm);
-                message_port_pub(pmt::intern("ppm"), msg_ppm);
-                d_last_fcch_time = d_current_time;
-            } 
-            else 
-            if (state == "synchronized")
-            {
-                d_last_fcch_time = d_current_time;
-                if(d_first_measurement)
+                if(state == "fcch_search")
                 {
-                    d_ppm_estimate = ppm;
-                    d_first_measurement = false; 
-                }
-                else
+                    send_ctrl_messages(ppm);
+                    d_last_fcch_time = d_current_time;
+                } 
+                else 
+                if (state == "synchronized")
                 {
-                    d_ppm_estimate = (1-d_alfa)*d_ppm_estimate+d_alfa*ppm;
-                }
-                
-                if(d_counter == 5)
-                {
-                    d_counter = 0;
-                    if(std::abs(d_last_ppm_estimate-d_ppm_estimate) > 0.1)
+                    d_last_fcch_time = d_current_time;
+                    if(d_first_measurement)
                     {
-                        pmt::pmt_t msg_ppm = pmt::from_double(ppm);
-                        message_port_pub(pmt::intern("ppm"), msg_ppm);
-                        d_last_ppm_estimate = d_ppm_estimate;
+                        d_ppm_estimate = ppm;
+                        d_first_measurement = false; 
+                    }
+                    else
+                    {
+                        d_ppm_estimate = (1-d_alfa)*d_ppm_estimate+d_alfa*ppm;
+                    }
+                    
+                    if(d_counter == 5)
+                    {
+                        d_counter = 0;
+                        if(std::abs(d_last_ppm_estimate-d_ppm_estimate) > 0.1)
+                        {
+//                            pmt::pmt_t msg_ppm = pmt::from_double(ppm);
+//                            message_port_pub(pmt::intern("ppm"), msg_ppm);
+                            send_ctrl_messages(ppm);
+                            d_last_ppm_estimate = d_ppm_estimate;
+                        }
+                    }
+                    else
+                    {
+                        d_counter=d_counter+1;
                     }
                 }
                 else
+                if(state == "sync_loss")
                 {
-                    d_counter=d_counter+1;
+                    reset();
+//                    pmt::pmt_t msg_ppm = pmt::from_double(0.0);
+//                    message_port_pub(pmt::intern("ppm"), msg_ppm);
+                    send_ctrl_messages(0);
                 }
-            } 
-            else
-            if(state == "sync_loss")
-            {
-                reset();
-                pmt::pmt_t msg_ppm = pmt::from_double(0.0);
-                message_port_pub(pmt::intern("ppm"), msg_ppm);
-            }            
+            }
         }
     }
 }
 
+void clock_offset_control_impl::send_ctrl_messages(float ppm)
+{
+//    pmt::pmt_t msg_ppm = pmt::from_double(ppm);
+//    message_port_pub(pmt::intern("ctrl"), msg_ppm);
+//    d_last_fcch_time = d_current_time;
+
+    pmt::pmt_t msg_set_phase_inc = pmt::cons(pmt::intern("set_phase_inc"), pmt::from_double(2*M_PI*d_fc/d_samp_rate*ppm/1.0e6));
+    message_port_pub(pmt::intern("ctrl"), msg_set_phase_inc);
+
+    pmt::pmt_t msg_set_resamp_ratio = pmt::cons(pmt::intern("set_resamp_ratio"), pmt::from_double(1+ppm/1.0e6));
+    message_port_pub(pmt::intern("ctrl"), msg_set_resamp_ratio);
+}
+
 void clock_offset_control_impl::timed_reset()
 {
     reset();
-    pmt::pmt_t msg_ppm = pmt::from_double(0.0);
-    message_port_pub(pmt::intern("ppm"), msg_ppm);
+    send_ctrl_messages(0);
 }
 
-
 void clock_offset_control_impl::reset()
 {
     d_ppm_estimate = -1e6;
diff --git a/lib/receiver/clock_offset_control_impl.h b/lib/receiver/clock_offset_control_impl.h
index 3c11a6f..cc0ea3d 100644
--- a/lib/receiver/clock_offset_control_impl.h
+++ b/lib/receiver/clock_offset_control_impl.h
@@ -32,9 +32,10 @@
     {
      private:
         float d_fc;
+        float d_samp_rate;
         float d_alfa;
         float d_ppm_estimate;
-        float d_last_ppm_estimate;        
+        float d_last_ppm_estimate;    
         bool  d_first_measurement;
         int   d_counter;
         std::string d_last_state;
@@ -43,13 +44,15 @@
         bool  d_first_time;
                         
         void process_measurement(pmt::pmt_t msg);
+        void send_ctrl_messages(float ppm);
         void timed_reset();
         void reset();
      public:
-       clock_offset_control_impl(float fc);
+       clock_offset_control_impl(float fc, float samp_rate);
       ~clock_offset_control_impl();
 
       virtual void set_fc(float fc);
+      virtual void set_samp_rate(float samp_rate);
     };
   } // namespace gsm
 } // namespace gr
diff --git a/lib/receiver/cx_channel_hopper_impl.cc b/lib/receiver/cx_channel_hopper_impl.cc
index 1fe15df..27a0cae 100644
--- a/lib/receiver/cx_channel_hopper_impl.cc
+++ b/lib/receiver/cx_channel_hopper_impl.cc
@@ -143,7 +143,9 @@
         gsmtap_hdr *header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst);
 
         uint32_t frame_nr = be32toh(header->frame_number);
-        uint16_t frame_ca = be16toh(header->arfcn);
+        uint16_t frame_ca = be16toh(header->arfcn) & 0x3FFF;    //change highest bits to '0'
+                                                                //in order to leave only ARFCN number
+
         int mai = calculate_ma_sfh(d_maio, d_hsn, d_narfcn, frame_nr);
 
         if(d_ma[mai] == (int)frame_ca) {
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index aa77ff1..bee42a8 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -41,7 +41,8 @@
     receiver/fcch_detector.py
     receiver/chirpz.py
     misc_utils/arfcn.py
-    misc_utils/clock_offset_corrector.py 
+    misc_utils/clock_offset_corrector.py
+    misc_utils/clock_offset_corrector_tagged.py
     misc_utils/hier_block.py DESTINATION ${GR_PYTHON_DIR}/grgsm
 )
 
@@ -61,5 +62,6 @@
 GR_ADD_TEST(qa_burst_sdcch_subslot_filter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_sdcch_subslot_filter.py)
 GR_ADD_TEST(qa_burst_fnr_filter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_fnr_filter.py)
 GR_ADD_TEST(qa_dummy_burst_filter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_dummy_burst_filter.py)
-GR_ADD_TEST(qa_arfcn ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_arfcn.py)
-GR_ADD_TEST(qa_msg_to_tag ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_msg_to_tag.py)
+#GR_ADD_TEST(qa_arfcn ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_arfcn.py)
+#GR_ADD_TEST(qa_msg_to_tag ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_msg_to_tag.py)
+#GR_ADD_TEST(qa_controlled_fractional_resampler_cc ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_controlled_fractional_resampler_cc.py)
diff --git a/python/__init__.py b/python/__init__.py
index dfa7a0e..2e35f6c 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -51,6 +51,7 @@
 from sch_detector import sch_detector
 from fcch_detector import fcch_detector
 from clock_offset_corrector import clock_offset_corrector
+from clock_offset_corrector_tagged import clock_offset_corrector_tagged
 from gsm_input import gsm_input
 from gsm_wideband_input import gsm_wideband_input
 from gsm_bcch_ccch_demapper import gsm_bcch_ccch_demapper
diff --git a/python/misc_utils/clock_offset_corrector_tagged.py b/python/misc_utils/clock_offset_corrector_tagged.py
new file mode 100644
index 0000000..5d198b0
--- /dev/null
+++ b/python/misc_utils/clock_offset_corrector_tagged.py
@@ -0,0 +1,81 @@
+# -*- coding: utf-8 -*-
+##################################################
+# GNU Radio Python Flow Graph
+# Title: Clock offset corrector
+# Author: Piotr Krysik
+# Description: Clock offset corrector with blocks that use tags to switch offsets
+# Generated: Fri Jul 15 10:09:22 2016
+##################################################
+
+from gnuradio import gr
+from gnuradio.filter import firdes
+import grgsm
+import math
+
+
+class clock_offset_corrector_tagged(grgsm.hier_block):
+
+    def __init__(self, fc=936.6e6, ppm=0, samp_rate_in=1625000.0/6.0*4.0):
+        gr.hier_block2.__init__(
+            self, "Clock offset corrector tagged",
+            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
+            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
+        )
+        self.message_port_register_hier_in("ctrl")
+
+        ##################################################
+        # Parameters
+        ##################################################
+        self.fc = fc
+        self.ppm = ppm
+        self.samp_rate_in = samp_rate_in
+
+        ##################################################
+        # Variables
+        ##################################################
+        self.samp_rate_out = samp_rate_out = samp_rate_in
+
+        ##################################################
+        # Blocks
+        ##################################################
+        self.gsm_controlled_rotator_cc_0 = grgsm.controlled_rotator_cc(ppm/1.0e6*2*math.pi*fc/samp_rate_in,samp_rate_out)
+        self.grgsm_msg_to_tag_0 = grgsm.msg_to_tag()
+        self.grgsm_controlled_fractional_resampler_cc_0 = grgsm.controlled_fractional_resampler_cc(0, 1.0)
+
+        ##################################################
+        # Connections
+        ##################################################
+        self.msg_connect((self, 'ctrl'), (self.grgsm_msg_to_tag_0, 'msg'))    
+        self.connect((self.grgsm_controlled_fractional_resampler_cc_0, 0), (self.gsm_controlled_rotator_cc_0, 0))    
+        self.connect((self.grgsm_msg_to_tag_0, 0), (self.grgsm_controlled_fractional_resampler_cc_0, 0))    
+        self.connect((self.gsm_controlled_rotator_cc_0, 0), (self, 0))    
+        self.connect((self, 0), (self.grgsm_msg_to_tag_0, 0))    
+
+    def get_fc(self):
+        return self.fc
+
+    def set_fc(self, fc):
+        self.fc = fc
+        self.gsm_controlled_rotator_cc_0.set_phase_inc(self.ppm/1.0e6*2*math.pi*self.fc/self.samp_rate_in)
+
+    def get_ppm(self):
+        return self.ppm
+
+    def set_ppm(self, ppm):
+        self.ppm = ppm
+        self.gsm_controlled_rotator_cc_0.set_phase_inc(self.ppm/1.0e6*2*math.pi*self.fc/self.samp_rate_in)
+
+    def get_samp_rate_in(self):
+        return self.samp_rate_in
+
+    def set_samp_rate_in(self, samp_rate_in):
+        self.samp_rate_in = samp_rate_in
+        self.set_samp_rate_out(self.samp_rate_in)
+        self.gsm_controlled_rotator_cc_0.set_phase_inc(self.ppm/1.0e6*2*math.pi*self.fc/self.samp_rate_in)
+
+    def get_samp_rate_out(self):
+        return self.samp_rate_out
+
+    def set_samp_rate_out(self, samp_rate_out):
+        self.samp_rate_out = samp_rate_out
+        self.gsm_controlled_rotator_cc_0.set_samp_rate(self.samp_rate_out)
diff --git a/python/qa_arfcn.py b/python/qa_arfcn.py
index 85be110..3e8a5ee 100755
--- a/python/qa_arfcn.py
+++ b/python/qa_arfcn.py
@@ -22,7 +22,8 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
+import arfcn
 import os
 import sys
 
@@ -30,257 +31,257 @@
 class qa_arfcn (gr_unittest.TestCase):
    
     def test_001_is_valid_arfcn(self):
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(259, 'GSM450'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(277, 'GSM450'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(293, 'GSM450'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(258, 'GSM450'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(294, 'GSM450'))
+        self.assertTrue(arfcn.is_valid_arfcn(259, 'GSM450'))
+        self.assertTrue(arfcn.is_valid_arfcn(277, 'GSM450'))
+        self.assertTrue(arfcn.is_valid_arfcn(293, 'GSM450'))
+        self.assertFalse(arfcn.is_valid_arfcn(258, 'GSM450'))
+        self.assertFalse(arfcn.is_valid_arfcn(294, 'GSM450'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(306, 'GSM480'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(323, 'GSM480'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(340, 'GSM480'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(305, 'GSM480'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(341, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_arfcn(306, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_arfcn(323, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_arfcn(340, 'GSM480'))
+        self.assertFalse(arfcn.is_valid_arfcn(305, 'GSM480'))
+        self.assertFalse(arfcn.is_valid_arfcn(341, 'GSM480'))
                 
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(128, 'GSM850'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(199, 'GSM850'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(251, 'GSM850'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(127, 'GSM480'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(251, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_arfcn(128, 'GSM850'))
+        self.assertTrue(arfcn.is_valid_arfcn(199, 'GSM850'))
+        self.assertTrue(arfcn.is_valid_arfcn(251, 'GSM850'))
+        self.assertFalse(arfcn.is_valid_arfcn(127, 'GSM480'))
+        self.assertFalse(arfcn.is_valid_arfcn(251, 'GSM480'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(1, 'P-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(63, 'P-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(124, 'P-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(0, 'P-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(125, 'P-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(1, 'P-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(63, 'P-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(124, 'P-GSM'))
+        self.assertFalse(arfcn.is_valid_arfcn(0, 'P-GSM'))
+        self.assertFalse(arfcn.is_valid_arfcn(125, 'P-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(975, 'E-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(999, 'E-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(1023, 'E-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(974, 'E-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(1024, 'E-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(975, 'E-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(999, 'E-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(1023, 'E-GSM'))
+        self.assertFalse(arfcn.is_valid_arfcn(974, 'E-GSM'))
+        self.assertFalse(arfcn.is_valid_arfcn(1024, 'E-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(955, 'R-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(989, 'R-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(1023, 'R-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(954, 'R-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(1024, 'R-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(955, 'R-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(989, 'R-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(1023, 'R-GSM'))
+        self.assertFalse(arfcn.is_valid_arfcn(954, 'R-GSM'))
+        self.assertFalse(arfcn.is_valid_arfcn(1024, 'R-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(512, 'DCS1800'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(732, 'DCS1800'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(885, 'DCS1800'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(511, 'DCS1800'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(886, 'DCS1800'))
+        self.assertTrue(arfcn.is_valid_arfcn(512, 'DCS1800'))
+        self.assertTrue(arfcn.is_valid_arfcn(732, 'DCS1800'))
+        self.assertTrue(arfcn.is_valid_arfcn(885, 'DCS1800'))
+        self.assertFalse(arfcn.is_valid_arfcn(511, 'DCS1800'))
+        self.assertFalse(arfcn.is_valid_arfcn(886, 'DCS1800'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(512, 'PCS1900'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(691, 'PCS1900'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(810, 'PCS1900'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(511, 'PCS1900'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(811, 'PCS1900'))
+        self.assertTrue(arfcn.is_valid_arfcn(512, 'PCS1900'))
+        self.assertTrue(arfcn.is_valid_arfcn(691, 'PCS1900'))
+        self.assertTrue(arfcn.is_valid_arfcn(810, 'PCS1900'))
+        self.assertFalse(arfcn.is_valid_arfcn(511, 'PCS1900'))
+        self.assertFalse(arfcn.is_valid_arfcn(811, 'PCS1900'))
 
 
     def test_002_is_valid_uplink(self):
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(450.6e6, 'GSM450'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(457.4e6, 'GSM450'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(450.4e6, 'GSM450'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(457.6e6, 'GSM450'))
+        self.assertTrue(arfcn.is_valid_uplink(450.6e6, 'GSM450'))
+        self.assertTrue(arfcn.is_valid_uplink(457.4e6, 'GSM450'))
+        self.assertFalse(arfcn.is_valid_uplink(450.4e6, 'GSM450'))
+        self.assertFalse(arfcn.is_valid_uplink(457.6e6, 'GSM450'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(479e6, 'GSM480'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(485.8e6, 'GSM480'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(478.8e6, 'GSM480'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(486e6, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_uplink(479e6, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_uplink(485.8e6, 'GSM480'))
+        self.assertFalse(arfcn.is_valid_uplink(478.8e6, 'GSM480'))
+        self.assertFalse(arfcn.is_valid_uplink(486e6, 'GSM480'))
                 
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(824.2e6, 'GSM850'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(848.8e6, 'GSM850'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(824e6, 'GSM850'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(849e6, 'GSM850'))
+        self.assertTrue(arfcn.is_valid_uplink(824.2e6, 'GSM850'))
+        self.assertTrue(arfcn.is_valid_uplink(848.8e6, 'GSM850'))
+        self.assertFalse(arfcn.is_valid_uplink(824e6, 'GSM850'))
+        self.assertFalse(arfcn.is_valid_uplink(849e6, 'GSM850'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(890.2e6, 'P-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(914.8e6, 'P-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(890e6, 'P-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(915e6, 'P-GSM'))
+        self.assertTrue(arfcn.is_valid_uplink(890.2e6, 'P-GSM'))
+        self.assertTrue(arfcn.is_valid_uplink(914.8e6, 'P-GSM'))
+        self.assertFalse(arfcn.is_valid_uplink(890e6, 'P-GSM'))
+        self.assertFalse(arfcn.is_valid_uplink(915e6, 'P-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(880.2e6, 'E-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(889.8e6, 'E-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(880e6, 'E-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(890e6, 'E-GSM'))
+        self.assertTrue(arfcn.is_valid_uplink(880.2e6, 'E-GSM'))
+        self.assertTrue(arfcn.is_valid_uplink(889.8e6, 'E-GSM'))
+        self.assertFalse(arfcn.is_valid_uplink(880e6, 'E-GSM'))
+        self.assertFalse(arfcn.is_valid_uplink(890e6, 'E-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(876.2e6, 'R-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(889.8e6, 'R-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(876e6, 'R-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(890e6, 'R-GSM'))
+        self.assertTrue(arfcn.is_valid_uplink(876.2e6, 'R-GSM'))
+        self.assertTrue(arfcn.is_valid_uplink(889.8e6, 'R-GSM'))
+        self.assertFalse(arfcn.is_valid_uplink(876e6, 'R-GSM'))
+        self.assertFalse(arfcn.is_valid_uplink(890e6, 'R-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(1710.2e6, 'DCS1800'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(1784.8e6, 'DCS1800'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(1710e6, 'DCS1800'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(1785e6, 'DCS1800'))
+        self.assertTrue(arfcn.is_valid_uplink(1710.2e6, 'DCS1800'))
+        self.assertTrue(arfcn.is_valid_uplink(1784.8e6, 'DCS1800'))
+        self.assertFalse(arfcn.is_valid_uplink(1710e6, 'DCS1800'))
+        self.assertFalse(arfcn.is_valid_uplink(1785e6, 'DCS1800'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(1850.2e6, 'PCS1900'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(1909.8e6, 'PCS1900'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(1850e6, 'PCS1900'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(1910e6, 'PCS1900'))
+        self.assertTrue(arfcn.is_valid_uplink(1850.2e6, 'PCS1900'))
+        self.assertTrue(arfcn.is_valid_uplink(1909.8e6, 'PCS1900'))
+        self.assertFalse(arfcn.is_valid_uplink(1850e6, 'PCS1900'))
+        self.assertFalse(arfcn.is_valid_uplink(1910e6, 'PCS1900'))
 
 
     def test_003_is_valid_downlink(self):
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(460.6e6, 'GSM450'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(467.4e6, 'GSM450'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(460.4e6, 'GSM450'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(467.6e6, 'GSM450'))
+        self.assertTrue(arfcn.is_valid_downlink(460.6e6, 'GSM450'))
+        self.assertTrue(arfcn.is_valid_downlink(467.4e6, 'GSM450'))
+        self.assertFalse(arfcn.is_valid_downlink(460.4e6, 'GSM450'))
+        self.assertFalse(arfcn.is_valid_downlink(467.6e6, 'GSM450'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(489e6, 'GSM480'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(495.8e6, 'GSM480'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(488.8e6, 'GSM480'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(496e6, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_downlink(489e6, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_downlink(495.8e6, 'GSM480'))
+        self.assertFalse(arfcn.is_valid_downlink(488.8e6, 'GSM480'))
+        self.assertFalse(arfcn.is_valid_downlink(496e6, 'GSM480'))
                 
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(869.2e6, 'GSM850'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(893.8e6, 'GSM850'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(869e6, 'GSM850'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(894e6, 'GSM850'))
+        self.assertTrue(arfcn.is_valid_downlink(869.2e6, 'GSM850'))
+        self.assertTrue(arfcn.is_valid_downlink(893.8e6, 'GSM850'))
+        self.assertFalse(arfcn.is_valid_downlink(869e6, 'GSM850'))
+        self.assertFalse(arfcn.is_valid_downlink(894e6, 'GSM850'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(935.2e6, 'P-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(959.8e6, 'P-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(935e6, 'P-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(960e6, 'P-GSM'))
+        self.assertTrue(arfcn.is_valid_downlink(935.2e6, 'P-GSM'))
+        self.assertTrue(arfcn.is_valid_downlink(959.8e6, 'P-GSM'))
+        self.assertFalse(arfcn.is_valid_downlink(935e6, 'P-GSM'))
+        self.assertFalse(arfcn.is_valid_downlink(960e6, 'P-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(925.2e6, 'E-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(934.8e6, 'E-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(925e6, 'E-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(935e6, 'E-GSM'))
+        self.assertTrue(arfcn.is_valid_downlink(925.2e6, 'E-GSM'))
+        self.assertTrue(arfcn.is_valid_downlink(934.8e6, 'E-GSM'))
+        self.assertFalse(arfcn.is_valid_downlink(925e6, 'E-GSM'))
+        self.assertFalse(arfcn.is_valid_downlink(935e6, 'E-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(921.2e6, 'R-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(934.8e6, 'R-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(921e6, 'R-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(935e6, 'R-GSM'))
+        self.assertTrue(arfcn.is_valid_downlink(921.2e6, 'R-GSM'))
+        self.assertTrue(arfcn.is_valid_downlink(934.8e6, 'R-GSM'))
+        self.assertFalse(arfcn.is_valid_downlink(921e6, 'R-GSM'))
+        self.assertFalse(arfcn.is_valid_downlink(935e6, 'R-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(1805.2e6, 'DCS1800'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(1879.8e6, 'DCS1800'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(1805e6, 'DCS1800'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(1880e6, 'DCS1800'))
+        self.assertTrue(arfcn.is_valid_downlink(1805.2e6, 'DCS1800'))
+        self.assertTrue(arfcn.is_valid_downlink(1879.8e6, 'DCS1800'))
+        self.assertFalse(arfcn.is_valid_downlink(1805e6, 'DCS1800'))
+        self.assertFalse(arfcn.is_valid_downlink(1880e6, 'DCS1800'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(1930.2e6, 'PCS1900'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(1989.8e6, 'PCS1900'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(1930e6, 'PCS1900'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(1990e6, 'PCS1900'))
+        self.assertTrue(arfcn.is_valid_downlink(1930.2e6, 'PCS1900'))
+        self.assertTrue(arfcn.is_valid_downlink(1989.8e6, 'PCS1900'))
+        self.assertFalse(arfcn.is_valid_downlink(1930e6, 'PCS1900'))
+        self.assertFalse(arfcn.is_valid_downlink(1990e6, 'PCS1900'))
         
     def test_004_arfcn2uplink(self):
-        self.assertEqual(450.6e6, grgsm.arfcn.arfcn2uplink(259, 'GSM450'))
-        self.assertEqual(457.4e6, grgsm.arfcn.arfcn2uplink(293, 'GSM450'))
+        self.assertEqual(450.6e6, arfcn.arfcn2uplink(259, 'GSM450'))
+        self.assertEqual(457.4e6, arfcn.arfcn2uplink(293, 'GSM450'))
         
-        self.assertEqual(479e6, grgsm.arfcn.arfcn2uplink(306, 'GSM480'))
-        self.assertEqual(485.8e6, grgsm.arfcn.arfcn2uplink(340, 'GSM480'))
+        self.assertEqual(479e6, arfcn.arfcn2uplink(306, 'GSM480'))
+        self.assertEqual(485.8e6, arfcn.arfcn2uplink(340, 'GSM480'))
         
-        self.assertEqual(824.2e6, grgsm.arfcn.arfcn2uplink(128, 'GSM850'))
-        self.assertEqual(848.8e6, grgsm.arfcn.arfcn2uplink(251, 'GSM850'))
+        self.assertEqual(824.2e6, arfcn.arfcn2uplink(128, 'GSM850'))
+        self.assertEqual(848.8e6, arfcn.arfcn2uplink(251, 'GSM850'))
         
-        self.assertEqual(890.2e6, grgsm.arfcn.arfcn2uplink(1, 'P-GSM'))
-        self.assertEqual(914.8e6, grgsm.arfcn.arfcn2uplink(124, 'P-GSM'))
+        self.assertEqual(890.2e6, arfcn.arfcn2uplink(1, 'P-GSM'))
+        self.assertEqual(914.8e6, arfcn.arfcn2uplink(124, 'P-GSM'))
         
-        self.assertEqual(880.2e6, grgsm.arfcn.arfcn2uplink(975, 'E-GSM'))
-        self.assertEqual(889.8e6, grgsm.arfcn.arfcn2uplink(1023, 'E-GSM'))
+        self.assertEqual(880.2e6, arfcn.arfcn2uplink(975, 'E-GSM'))
+        self.assertEqual(889.8e6, arfcn.arfcn2uplink(1023, 'E-GSM'))
         
-        self.assertEqual(876.2e6, grgsm.arfcn.arfcn2uplink(955, 'R-GSM'))
-        self.assertEqual(889.8e6, grgsm.arfcn.arfcn2uplink(1023, 'R-GSM'))
+        self.assertEqual(876.2e6, arfcn.arfcn2uplink(955, 'R-GSM'))
+        self.assertEqual(889.8e6, arfcn.arfcn2uplink(1023, 'R-GSM'))
         
-        self.assertEqual(1710.2e6, grgsm.arfcn.arfcn2uplink(512, 'DCS1800'))
-        self.assertEqual(1784.8e6, grgsm.arfcn.arfcn2uplink(885, 'DCS1800'))
+        self.assertEqual(1710.2e6, arfcn.arfcn2uplink(512, 'DCS1800'))
+        self.assertEqual(1784.8e6, arfcn.arfcn2uplink(885, 'DCS1800'))
         
-        self.assertEqual(1850.2e6, grgsm.arfcn.arfcn2uplink(512, 'PCS1900'))
-        self.assertEqual(1909.8e6, grgsm.arfcn.arfcn2uplink(810, 'PCS1900'))
+        self.assertEqual(1850.2e6, arfcn.arfcn2uplink(512, 'PCS1900'))
+        self.assertEqual(1909.8e6, arfcn.arfcn2uplink(810, 'PCS1900'))
         
     def test_005_arfcn2downlink(self):
-        self.assertEqual(460.6e6, grgsm.arfcn.arfcn2downlink(259, 'GSM450'))
-        self.assertEqual(467.4e6, grgsm.arfcn.arfcn2downlink(293, 'GSM450'))
+        self.assertEqual(460.6e6, arfcn.arfcn2downlink(259, 'GSM450'))
+        self.assertEqual(467.4e6, arfcn.arfcn2downlink(293, 'GSM450'))
         
-        self.assertEqual(489e6, grgsm.arfcn.arfcn2downlink(306, 'GSM480'))
-        self.assertEqual(495.8e6, grgsm.arfcn.arfcn2downlink(340, 'GSM480'))
+        self.assertEqual(489e6, arfcn.arfcn2downlink(306, 'GSM480'))
+        self.assertEqual(495.8e6, arfcn.arfcn2downlink(340, 'GSM480'))
         
-        self.assertEqual(869.2e6, grgsm.arfcn.arfcn2downlink(128, 'GSM850'))
-        self.assertEqual(893.8e6, grgsm.arfcn.arfcn2downlink(251, 'GSM850'))
+        self.assertEqual(869.2e6, arfcn.arfcn2downlink(128, 'GSM850'))
+        self.assertEqual(893.8e6, arfcn.arfcn2downlink(251, 'GSM850'))
         
-        self.assertEqual(935.2e6, grgsm.arfcn.arfcn2downlink(1, 'P-GSM'))
-        self.assertEqual(959.8e6, grgsm.arfcn.arfcn2downlink(124, 'P-GSM'))
+        self.assertEqual(935.2e6, arfcn.arfcn2downlink(1, 'P-GSM'))
+        self.assertEqual(959.8e6, arfcn.arfcn2downlink(124, 'P-GSM'))
         
-        self.assertEqual(925.2e6, grgsm.arfcn.arfcn2downlink(975, 'E-GSM'))
-        self.assertEqual(934.8e6, grgsm.arfcn.arfcn2downlink(1023, 'E-GSM'))
+        self.assertEqual(925.2e6, arfcn.arfcn2downlink(975, 'E-GSM'))
+        self.assertEqual(934.8e6, arfcn.arfcn2downlink(1023, 'E-GSM'))
         
-        self.assertEqual(921.2e6, grgsm.arfcn.arfcn2downlink(955, 'R-GSM'))
-        self.assertEqual(934.8e6, grgsm.arfcn.arfcn2downlink(1023, 'R-GSM'))
+        self.assertEqual(921.2e6, arfcn.arfcn2downlink(955, 'R-GSM'))
+        self.assertEqual(934.8e6, arfcn.arfcn2downlink(1023, 'R-GSM'))
         
-        self.assertEqual(1805.2e6, grgsm.arfcn.arfcn2downlink(512, 'DCS1800'))
-        self.assertEqual(1879.8e6, grgsm.arfcn.arfcn2downlink(885, 'DCS1800'))
+        self.assertEqual(1805.2e6, arfcn.arfcn2downlink(512, 'DCS1800'))
+        self.assertEqual(1879.8e6, arfcn.arfcn2downlink(885, 'DCS1800'))
         
-        self.assertEqual(1930.2e6, grgsm.arfcn.arfcn2downlink(512, 'PCS1900'))
-        self.assertEqual(1989.8e6, grgsm.arfcn.arfcn2downlink(810, 'PCS1900'))
+        self.assertEqual(1930.2e6, arfcn.arfcn2downlink(512, 'PCS1900'))
+        self.assertEqual(1989.8e6, arfcn.arfcn2downlink(810, 'PCS1900'))
         
     def test_006_uplink2arfcn(self):
-        self.assertEqual(259, grgsm.arfcn.uplink2arfcn(450.6e6, 'GSM450'))
-        self.assertEqual(293, grgsm.arfcn.uplink2arfcn(457.4e6, 'GSM450'))
+        self.assertEqual(259, arfcn.uplink2arfcn(450.6e6, 'GSM450'))
+        self.assertEqual(293, arfcn.uplink2arfcn(457.4e6, 'GSM450'))
         
-        self.assertEqual(306, grgsm.arfcn.uplink2arfcn(479e6, 'GSM480'))
-        self.assertEqual(340, grgsm.arfcn.uplink2arfcn(485.8e6, 'GSM480'))
+        self.assertEqual(306, arfcn.uplink2arfcn(479e6, 'GSM480'))
+        self.assertEqual(340, arfcn.uplink2arfcn(485.8e6, 'GSM480'))
         
-        self.assertEqual(128, grgsm.arfcn.uplink2arfcn(824.2e6, 'GSM850'))
-        self.assertEqual(251, grgsm.arfcn.uplink2arfcn(848.8e6, 'GSM850'))
+        self.assertEqual(128, arfcn.uplink2arfcn(824.2e6, 'GSM850'))
+        self.assertEqual(251, arfcn.uplink2arfcn(848.8e6, 'GSM850'))
         
-        self.assertEqual(1, grgsm.arfcn.uplink2arfcn(890.2e6, 'P-GSM'))
-        self.assertEqual(124, grgsm.arfcn.uplink2arfcn(914.8e6, 'P-GSM'))
+        self.assertEqual(1, arfcn.uplink2arfcn(890.2e6, 'P-GSM'))
+        self.assertEqual(124, arfcn.uplink2arfcn(914.8e6, 'P-GSM'))
         
-        self.assertEqual(975, grgsm.arfcn.uplink2arfcn(880.2e6, 'E-GSM'))
-        self.assertEqual(1023, grgsm.arfcn.uplink2arfcn(889.8e6, 'E-GSM'))
+        self.assertEqual(975, arfcn.uplink2arfcn(880.2e6, 'E-GSM'))
+        self.assertEqual(1023, arfcn.uplink2arfcn(889.8e6, 'E-GSM'))
         
-        self.assertEqual(955, grgsm.arfcn.uplink2arfcn(876.2e6, 'R-GSM'))
-        self.assertEqual(1023, grgsm.arfcn.uplink2arfcn(889.8e6, 'R-GSM'))
+        self.assertEqual(955, arfcn.uplink2arfcn(876.2e6, 'R-GSM'))
+        self.assertEqual(1023, arfcn.uplink2arfcn(889.8e6, 'R-GSM'))
         
-        self.assertEqual(512, grgsm.arfcn.uplink2arfcn(1710.2e6, 'DCS1800'))
-        self.assertEqual(885, grgsm.arfcn.uplink2arfcn(1784.8e6, 'DCS1800'))
+        self.assertEqual(512, arfcn.uplink2arfcn(1710.2e6, 'DCS1800'))
+        self.assertEqual(885, arfcn.uplink2arfcn(1784.8e6, 'DCS1800'))
         
-        self.assertEqual(512, grgsm.arfcn.uplink2arfcn(1850.2e6, 'PCS1900'))
-        self.assertEqual(810, grgsm.arfcn.uplink2arfcn(1909.8e6, 'PCS1900'))
+        self.assertEqual(512, arfcn.uplink2arfcn(1850.2e6, 'PCS1900'))
+        self.assertEqual(810, arfcn.uplink2arfcn(1909.8e6, 'PCS1900'))
         
     def test_007_downlink2arfcn(self):
-        self.assertEqual(259, grgsm.arfcn.downlink2arfcn(460.6e6, 'GSM450'))
-        self.assertEqual(293, grgsm.arfcn.downlink2arfcn(467.4e6, 'GSM450'))
+        self.assertEqual(259, arfcn.downlink2arfcn(460.6e6, 'GSM450'))
+        self.assertEqual(293, arfcn.downlink2arfcn(467.4e6, 'GSM450'))
         
-        self.assertEqual(306, grgsm.arfcn.downlink2arfcn(489e6, 'GSM480'))
-        self.assertEqual(340, grgsm.arfcn.downlink2arfcn(495.8e6, 'GSM480'))
+        self.assertEqual(306, arfcn.downlink2arfcn(489e6, 'GSM480'))
+        self.assertEqual(340, arfcn.downlink2arfcn(495.8e6, 'GSM480'))
         
-        self.assertEqual(128, grgsm.arfcn.downlink2arfcn(869.2e6, 'GSM850'))
-        self.assertEqual(251, grgsm.arfcn.downlink2arfcn(893.8e6, 'GSM850'))
+        self.assertEqual(128, arfcn.downlink2arfcn(869.2e6, 'GSM850'))
+        self.assertEqual(251, arfcn.downlink2arfcn(893.8e6, 'GSM850'))
         
-        self.assertEqual(1, grgsm.arfcn.downlink2arfcn(935.2e6, 'P-GSM'))
-        self.assertEqual(124, grgsm.arfcn.downlink2arfcn(959.8e6, 'P-GSM'))
+        self.assertEqual(1, arfcn.downlink2arfcn(935.2e6, 'P-GSM'))
+        self.assertEqual(124, arfcn.downlink2arfcn(959.8e6, 'P-GSM'))
         
-        self.assertEqual(975, grgsm.arfcn.downlink2arfcn(925.2e6, 'E-GSM'))
-        self.assertEqual(1023, grgsm.arfcn.downlink2arfcn(934.8e6, 'E-GSM'))
+        self.assertEqual(975, arfcn.downlink2arfcn(925.2e6, 'E-GSM'))
+        self.assertEqual(1023, arfcn.downlink2arfcn(934.8e6, 'E-GSM'))
         
-        self.assertEqual(955, grgsm.arfcn.downlink2arfcn(921.2e6, 'R-GSM'))
-        self.assertEqual(1023, grgsm.arfcn.downlink2arfcn(934.8e6, 'R-GSM'))
+        self.assertEqual(955, arfcn.downlink2arfcn(921.2e6, 'R-GSM'))
+        self.assertEqual(1023, arfcn.downlink2arfcn(934.8e6, 'R-GSM'))
         
-        self.assertEqual(512, grgsm.arfcn.downlink2arfcn(1805.2e6, 'DCS1800'))
-        self.assertEqual(885, grgsm.arfcn.downlink2arfcn(1879.8e6, 'DCS1800'))
+        self.assertEqual(512, arfcn.downlink2arfcn(1805.2e6, 'DCS1800'))
+        self.assertEqual(885, arfcn.downlink2arfcn(1879.8e6, 'DCS1800'))
         
-        self.assertEqual(512, grgsm.arfcn.downlink2arfcn(1930.2e6, 'PCS1900'))
-        self.assertEqual(810, grgsm.arfcn.downlink2arfcn(1989.8e6, 'PCS1900'))
+        self.assertEqual(512, arfcn.downlink2arfcn(1930.2e6, 'PCS1900'))
+        self.assertEqual(810, arfcn.downlink2arfcn(1989.8e6, 'PCS1900'))
         
     def test_008_firstarfcn(self):
-        self.assertEqual(259, grgsm.arfcn.get_first_arfcn('GSM450'))
-        self.assertEqual(306, grgsm.arfcn.get_first_arfcn('GSM480'))
-        self.assertEqual(128, grgsm.arfcn.get_first_arfcn('GSM850'))
-        self.assertEqual(1, grgsm.arfcn.get_first_arfcn('P-GSM'))
-        self.assertEqual(975, grgsm.arfcn.get_first_arfcn('E-GSM'))
-        self.assertEqual(955, grgsm.arfcn.get_first_arfcn('R-GSM'))
-        self.assertEqual(512, grgsm.arfcn.get_first_arfcn('DCS1800'))
-        self.assertEqual(512, grgsm.arfcn.get_first_arfcn('PCS1900'))
+        self.assertEqual(259, arfcn.get_first_arfcn('GSM450'))
+        self.assertEqual(306, arfcn.get_first_arfcn('GSM480'))
+        self.assertEqual(128, arfcn.get_first_arfcn('GSM850'))
+        self.assertEqual(1, arfcn.get_first_arfcn('P-GSM'))
+        self.assertEqual(975, arfcn.get_first_arfcn('E-GSM'))
+        self.assertEqual(955, arfcn.get_first_arfcn('R-GSM'))
+        self.assertEqual(512, arfcn.get_first_arfcn('DCS1800'))
+        self.assertEqual(512, arfcn.get_first_arfcn('PCS1900'))
 
     def test_009_firstarfcn(self):
-        self.assertEqual(293, grgsm.arfcn.get_last_arfcn('GSM450'))
-        self.assertEqual(340, grgsm.arfcn.get_last_arfcn('GSM480'))
-        self.assertEqual(251, grgsm.arfcn.get_last_arfcn('GSM850'))
-        self.assertEqual(124, grgsm.arfcn.get_last_arfcn('P-GSM'))
-        self.assertEqual(1023, grgsm.arfcn.get_last_arfcn('E-GSM'))
-        self.assertEqual(1023, grgsm.arfcn.get_last_arfcn('R-GSM'))
-        self.assertEqual(885, grgsm.arfcn.get_last_arfcn('DCS1800'))
-        self.assertEqual(810, grgsm.arfcn.get_last_arfcn('PCS1900'))        
+        self.assertEqual(293, arfcn.get_last_arfcn('GSM450'))
+        self.assertEqual(340, arfcn.get_last_arfcn('GSM480'))
+        self.assertEqual(251, arfcn.get_last_arfcn('GSM850'))
+        self.assertEqual(124, arfcn.get_last_arfcn('P-GSM'))
+        self.assertEqual(1023, arfcn.get_last_arfcn('E-GSM'))
+        self.assertEqual(1023, arfcn.get_last_arfcn('R-GSM'))
+        self.assertEqual(885, arfcn.get_last_arfcn('DCS1800'))
+        self.assertEqual(810, arfcn.get_last_arfcn('PCS1900'))        
         
 if __name__ == '__main__':
     gr_unittest.run(qa_arfcn, "qa_arfcn.xml")
diff --git a/python/qa_burst_fnr_filter.py b/python/qa_burst_fnr_filter.py
index cdd3ff4..93152df 100755
--- a/python/qa_burst_fnr_filter.py
+++ b/python/qa_burst_fnr_filter.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import pmt
 
 class qa_burst_fnr_filter (gr_unittest.TestCase):
diff --git a/python/qa_burst_printer.py b/python/qa_burst_printer.py
index 97fbe71..49c89e4 100755
--- a/python/qa_burst_printer.py
+++ b/python/qa_burst_printer.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import os
 import pmt
 import sys
diff --git a/python/qa_burst_sdcch_subslot_filter.py b/python/qa_burst_sdcch_subslot_filter.py
index 82136bf..9cb3cd5 100755
--- a/python/qa_burst_sdcch_subslot_filter.py
+++ b/python/qa_burst_sdcch_subslot_filter.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 
 class qa_burst_sdcch_subslot_filter (gr_unittest.TestCase):
     # 102 random bursts as test input
diff --git a/python/qa_burst_sdcch_subslot_splitter.py b/python/qa_burst_sdcch_subslot_splitter.py
index ff30c2b..1800137 100755
--- a/python/qa_burst_sdcch_subslot_splitter.py
+++ b/python/qa_burst_sdcch_subslot_splitter.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import pmt
 
 class qa_burst_sdcch_subslot_splitter (gr_unittest.TestCase):
diff --git a/python/qa_burst_timeslot_filter.py b/python/qa_burst_timeslot_filter.py
index 6c8fb2a..4c0f655 100755
--- a/python/qa_burst_timeslot_filter.py
+++ b/python/qa_burst_timeslot_filter.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import pmt
 
 class qa_burst_timeslot_filter (gr_unittest.TestCase):
diff --git a/python/qa_burst_timeslot_splitter.py b/python/qa_burst_timeslot_splitter.py
index b162a2e..cac9ae1 100755
--- a/python/qa_burst_timeslot_splitter.py
+++ b/python/qa_burst_timeslot_splitter.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import pmt
 
 class qa_burst_timeslot_splitter (gr_unittest.TestCase):
diff --git a/python/qa_controlled_fractional_resampler_cc.py b/python/qa_controlled_fractional_resampler_cc.py
new file mode 100755
index 0000000..417ab5b
--- /dev/null
+++ b/python/qa_controlled_fractional_resampler_cc.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# @file
+# @author Piotr Krysik <ptrkrysik@gmail.com>
+# @section LICENSE
+# 
+# Gr-gsm is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+# 
+# Gr-gsm is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with gr-gsm; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+# 
+# 
+
+from gnuradio import gr, gr_unittest
+from gnuradio import blocks
+import grgsm_swig as grgsm
+
+class qa_controlled_fractional_resampler_cc (gr_unittest.TestCase):
+
+    def setUp (self):
+        self.tb = gr.top_block ()
+
+    def tearDown (self):
+        self.tb = None
+
+    def test_001_t (self):
+        # set up fg
+        self.tb.run ()
+        # check data
+
+
+if __name__ == '__main__':
+    gr_unittest.run(qa_controlled_fractional_resampler_cc, "qa_controlled_fractional_resampler_cc.xml")
diff --git a/python/qa_decryption.py b/python/qa_decryption.py
index 08f0915..71feb62 100755
--- a/python/qa_decryption.py
+++ b/python/qa_decryption.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import pmt
 
 class qa_decryption (gr_unittest.TestCase):
diff --git a/python/qa_dummy_burst_filter.py b/python/qa_dummy_burst_filter.py
index 5a78890..a86a0e5 100755
--- a/python/qa_dummy_burst_filter.py
+++ b/python/qa_dummy_burst_filter.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 
 class qa_dummy_burst_filter (gr_unittest.TestCase):
 
diff --git a/python/qa_message_printer.py b/python/qa_message_printer.py
index 53a286f..4e54df1 100755
--- a/python/qa_message_printer.py
+++ b/python/qa_message_printer.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import os
 import pmt
 import sys
diff --git a/python/qa_message_source_sink.py b/python/qa_message_source_sink.py
index 7ed3608..a82b16f 100755
--- a/python/qa_message_source_sink.py
+++ b/python/qa_message_source_sink.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import os
 import pmt
 import sys
diff --git a/python/receiver/gsm_input.py b/python/receiver/gsm_input.py
index 97ab633..b18a631 100644
--- a/python/receiver/gsm_input.py
+++ b/python/receiver/gsm_input.py
@@ -38,11 +38,11 @@
         ##################################################
         # Blocks
         ##################################################
-        self.message_port_register_hier_in("ppm_in")
+        self.message_port_register_hier_in("ctrl_in")
 
         self.low_pass_filter_0_0 = filter.fir_filter_ccf(1, firdes.low_pass(
         	1, samp_rate_out, 125e3, 5e3, firdes.WIN_HAMMING, 6.76))
-        self.gsm_clock_offset_corrector_0 = grgsm.clock_offset_corrector(
+        self.gsm_clock_offset_corrector_tagged_0 = grgsm.clock_offset_corrector_tagged(
             fc=fc,
             ppm=ppm,
             samp_rate_in=samp_rate_in,
@@ -54,21 +54,17 @@
         ##################################################
         self.connect((self.low_pass_filter_0_0, 0), (self, 0))
         self.connect((self.fractional_resampler_xx_0, 0), (self.low_pass_filter_0_0, 0))
-        self.connect((self.gsm_clock_offset_corrector_0, 0), (self.fractional_resampler_xx_0, 0))
-        self.connect((self, 0), (self.gsm_clock_offset_corrector_0, 0))
+        self.connect((self.gsm_clock_offset_corrector_tagged_0, 0), (self.fractional_resampler_xx_0, 0))
+        self.connect((self, 0), (self.gsm_clock_offset_corrector_tagged_0, 0))
 
         ##################################################
         # Asynch Message Connections
         ##################################################
-        self.msg_connect(self, "ppm_in", self.gsm_clock_offset_corrector_0, "ppm_in")
+        self.msg_connect((self, 'ctrl_in'), (self.gsm_clock_offset_corrector_tagged_0, 'ctrl'))
 
-
-    def get_ppm(self):
-        return self.ppm
-
-    def set_ppm(self, ppm):
-        self.ppm = ppm
-        self.gsm_clock_offset_corrector_0.set_ppm(self.ppm)
+    def set_fc(self, fc):
+        self.fc = fc
+        self.gsm_clock_offset_corrector_tagged_0.set_fc(self.fc)
 
     def get_osr(self):
         return self.osr
@@ -77,26 +73,25 @@
         self.osr = osr
         self.set_samp_rate_out(1625000.0/6.0*self.osr)
 
-    def get_fc(self):
-        return self.fc
+    def get_ppm(self):
+        return self.ppm
 
-    def set_fc(self, fc):
-        self.fc = fc
-        self.gsm_clock_offset_corrector_0.set_fc(self.fc)
+    def set_ppm(self, ppm):
+        self.ppm = ppm
+        self.gsm_clock_offset_corrector_tagged_0.set_ppm(self.ppm)
 
     def get_samp_rate_in(self):
         return self.samp_rate_in
 
     def set_samp_rate_in(self, samp_rate_in):
         self.samp_rate_in = samp_rate_in
+        self.gsm_clock_offset_corrector_tagged_0.set_samp_rate_in(self.samp_rate_in)
         self.fractional_resampler_xx_0.set_resamp_ratio(self.samp_rate_in/self.samp_rate_out)
-        self.gsm_clock_offset_corrector_0.set_samp_rate_in(self.samp_rate_in)
 
     def get_samp_rate_out(self):
         return self.samp_rate_out
 
     def set_samp_rate_out(self, samp_rate_out):
         self.samp_rate_out = samp_rate_out
-        self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate_out, 125e3, 5e3, firdes.WIN_HAMMING, 6.76))
         self.fractional_resampler_xx_0.set_resamp_ratio(self.samp_rate_in/self.samp_rate_out)
-
+        self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate_out, 125e3, 5e3, firdes.WIN_HAMMING, 6.76))
diff --git a/swig/grgsm_swig.i b/swig/grgsm_swig.i
index 81a5942..39fc3d4 100644
--- a/swig/grgsm_swig.i
+++ b/swig/grgsm_swig.i
@@ -38,6 +38,7 @@
 #include "grgsm/misc_utils/message_file_sink.h"
 #include "grgsm/misc_utils/message_file_source.h"
 #include "grgsm/msg_to_tag.h"
+#include "grgsm/controlled_fractional_resampler_cc.h"
 %}
 
 %include "grgsm/receiver/receiver.h"
@@ -105,4 +106,6 @@
 %include "grgsm/qa_utils/message_sink.h"
 GR_SWIG_BLOCK_MAGIC2(gsm, message_sink);
 %include "grgsm/msg_to_tag.h"
-GR_SWIG_BLOCK_MAGIC2(grgsm, msg_to_tag);
+GR_SWIG_BLOCK_MAGIC2(gsm, msg_to_tag);
+%include "grgsm/controlled_fractional_resampler_cc.h"
+GR_SWIG_BLOCK_MAGIC2(gsm, controlled_fractional_resampler_cc);
diff --git a/tests/dockerfiles/Ubuntu_16_04_debinstall.docker b/tests/dockerfiles/Ubuntu_16_04_debinstall.docker
new file mode 100644
index 0000000..0a476ce
--- /dev/null
+++ b/tests/dockerfiles/Ubuntu_16_04_debinstall.docker
@@ -0,0 +1,13 @@
+FROM ubuntu:16.04
+MAINTAINER Ash Wilson
+
+RUN apt-get update && apt-get install -y \
+    software-properties-common
+
+RUN add-apt-repository -y ppa:ptrkrysik/gr-gsm
+
+RUN apt-get update && apt-get install -y \
+    gr-gsm
+
+COPY ./ /src/
+RUN ls /src
diff --git a/tests/fixtures/grgsm_decode_test1_expected b/tests/fixtures/grgsm_decode_test1_expected
index eb78bb9..1ce6f36 100644
--- a/tests/fixtures/grgsm_decode_test1_expected
+++ b/tests/fixtures/grgsm_decode_test1_expected
@@ -1,3 +1,5 @@
+860902 1329872:  15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860906 1330004:  15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
 860912 1330176:  15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
 860916 1330308:  15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
 860922 1330506:  15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b