Merge branch 'development' of https://github.com/ptrkrysik/gr-gsm into development
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/apps/grgsm_decode b/apps/grgsm_decode
index cc2a55d..14578d5 100755
--- a/apps/grgsm_decode
+++ b/apps/grgsm_decode
@@ -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..2524a63 100755
--- a/apps/grgsm_scanner
+++ b/apps/grgsm_scanner
@@ -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/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/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/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/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 3ce05f8..fb39f4c 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,18 +51,22 @@
     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
 )
 
 
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..62087d6
--- /dev/null
+++ b/lib/misc_utils/controlled_fractional_resampler_cc_impl.cc
@@ -0,0 +1,198 @@
+/* -*- 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]);
+
+//      std::cout << "-----------------------------" << std::endl;
+//      std::cout << "ninput_items[0] " << ninput_items[0] << std::endl;
+//      std::cout << "noutput_items " << noutput_items << std::endl;
+      
+      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;
+          }
+          
+  //        std::cout << "samples_to_produce = (tag_offset_rel-processed_in_sum)/d_mu_inc: " << samples_to_produce << " = " << tag_offset_rel << " - " << processed_in_sum << std::endl;
+          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;
+
+  //        std::cout << "d_ii " << d_ii << std::endl;        
+  //        std::cout << "produced_out_sum + nitems_written(0) " << produced_out_sum + nitems_written(0) << std::endl;
+          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);
+          }
+        }
+//        std::cout << "processed_in: " << processed_in <<   " tag_offset_rel: " << tag_offset_rel << " produced_out_sum: " << produced_out_sum << std::endl;        
+//        std::cout << "Setting resamp ratio: " << d_mu_inc << std::endl;
+      }
+
+//      std::cout << "noutput_items: " << noutput_items << " produced_out_sum: " << produced_out_sum << std::endl;
+//      std::cout << "last_resample_outputs: " << (noutput_items-produced_out_sum) << std::endl;
+//      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;
+//      processed_in = resample(in, 0, out, 0, noutput_items);
+
+      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/python/CMakeLists.txt b/python/CMakeLists.txt
index aa77ff1..a9c4599 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
 )
 
@@ -63,3 +64,4 @@
 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_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_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/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);