Merge branch 'master' of https://github.com/m-alizadeh/gr-gsm into m-alizadeh-master
diff --git a/.gitignore b/.gitignore
index 321fa74..99dd781 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,5 @@
 *.pyo
 .unittests
 build/
+debian/tmp/
+debian/files
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 551b982..6c1b51b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,7 @@
 env:
   #- DOCKERFILE=tests/dockerfiles/Debian_Jessie.docker IMGNAME=debjess-grgsm
   #- DOCKERFILE=tests/dockerfiles/Ubuntu_15_04.docker IMGNAME=ubu15.04-grgsm
-  - DOCKERFILE=tests/dockerfiles/Debian_testing.docker IMGNAME=debtest-grgsm
+  #- DOCKERFILE=tests/dockerfiles/Debian_testing.docker IMGNAME=debtest-grgsm
   - DOCKERFILE=tests/dockerfiles/Ubuntu_16_04.docker IMGNAME=ubu16.04-grgsm
 
 services:
@@ -17,4 +17,3 @@
 script:
   - docker run -it --rm $IMGNAME sh -c 'cd /src/build;make test'
   - docker run -it --rm $IMGNAME /src/tests/scripts/decode.sh
-
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00c37dd..5832d42 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,6 +72,8 @@
     if("${SWIG_VERSION}" VERSION_GREATER "1.3.30")
         set(SWIG_VERSION_CHECK TRUE)
     endif()
+else()
+    message(FATAL_ERROR "SWIG required to compile gr-gsm")
 endif(SWIG_FOUND)
 
 
@@ -99,7 +101,7 @@
 ########################################################################
 # Find gnuradio build dependencies
 ########################################################################
-set(GR_REQUIRED_COMPONENTS RUNTIME PMT)
+set(GR_REQUIRED_COMPONENTS RUNTIME FILTER PMT)
 find_package(Gnuradio)
 find_package(Volk)
 find_package(CppUnit)
@@ -138,14 +140,14 @@
     ${CMAKE_BINARY_DIR}/include
     ${Boost_INCLUDE_DIRS}
     ${CPPUNIT_INCLUDE_DIRS}
-    ${GNURADIO_RUNTIME_INCLUDE_DIRS}
+    ${GNURADIO_ALL_INCLUDE_DIRS}
     ${LIBOSMOCORE_INCLUDE_DIR}
 )
 
 link_directories(
     ${Boost_LIBRARY_DIRS}
     ${CPPUNIT_LIBRARY_DIRS}
-    ${GNURADIO_RUNTIME_LIBRARY_DIRS}
+    ${GNURADIO_ALL_LIBRARY_DIRS}
 )
 
 # Set component parameters
diff --git a/PACKAGING.md b/PACKAGING.md
deleted file mode 100644
index 75914db..0000000
--- a/PACKAGING.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# Packaging gr-gsm
-## This is a work in progress...
-
-* Run the build.sh script!
diff --git a/README.md b/README.md
index c8ab407..bcd359f 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@
 
 Development
 ===========
-New features are accepted through github's pull requests. When creating pull request try to make it adress one topic (addition of a feature x, corretion of bug y).
+New features are accepted through github's pull requests. When creating pull request try to make it adress one topic (addition of a feature x, correction of bug y).
 
 If you wish to develop something for gr-gsm but don't know exactly what, then look for issues with label "Enhancement". Select one that you feel you are able to complete. After that claim it by commenting in the comment section of the issue. If there is any additional information about gr-gsm needed by you to make completing the task easier - just ask.
 
diff --git a/apps/grgsm_decode b/apps/grgsm_decode
index cc2a55d..94a2ba0 100755
--- a/apps/grgsm_decode
+++ b/apps/grgsm_decode
@@ -36,11 +36,11 @@
 
     def __init__(self, timeslot=0, subslot=None, chan_mode='BCCH',
                  burst_file=None,
-                 cfile=None, fc=939.4e6, samp_rate=2e6, 
+                 cfile=None, fc=None, samp_rate=2e6, 
                  a5=1, a5_kc=None,
                  speech_file=None, speech_codec=None,
                  verbose=False,
-                 print_bursts=False):
+                 print_bursts=False, ppm=0):
 
         gr.top_block.__init__(self, "Gr-gsm Decode")
 
@@ -73,10 +73,10 @@
             self.file_source = blocks.file_source(gr.sizeof_gr_complex*1, self.cfile, False)
             self.receiver = grgsm.receiver(4, ([0]), ([]))
             if self.fc is not None:
-                self.input_adapter = grgsm.gsm_input(ppm=0, osr=4, fc=self.fc, samp_rate_in=samp_rate)
-                self.offset_control = grgsm.clock_offset_control(self.fc)
+                self.input_adapter = grgsm.gsm_input(ppm=ppm, osr=4, fc=self.fc, samp_rate_in=samp_rate)
+                self.offset_control = grgsm.clock_offset_control(self.fc, self.samp_rate)
             else:
-                self.input_adapter = grgsm.gsm_input(ppm=0, osr=4, samp_rate_in=samp_rate)
+                self.input_adapter = grgsm.gsm_input(ppm=ppm, osr=4, samp_rate_in=samp_rate)
 
         self.dummy_burst_filter = grgsm.dummy_burst_filter()
         self.timeslot_filter = grgsm.burst_timeslot_filter(self.timeslot)
@@ -95,7 +95,9 @@
             self.sdcch8_demapper = grgsm.gsm_sdcch8_demapper(self.timeslot)
         elif self.chan_mode == 'TCHF':
             self.tch_f_demapper = grgsm.tch_f_chans_demapper(self.timeslot)
-            self.tch_f_decoder = grgsm.tch_f_decoder(speech_codec, speech_file)
+            self.tch_f_decoder = grgsm.tch_f_decoder(speech_codec)
+            self.tch_f_pdu_to_tagged_stream = blocks.pdu_to_tagged_stream(blocks.byte_t, "packet_len")
+            self.tch_f_file_sink = blocks.file_sink(gr.sizeof_char*1, speech_file, False)
 
         if self.kc != [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]:
             self.decryption = grgsm.decryption(self.kc, self.a5)
@@ -126,7 +128,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")
 
@@ -198,6 +200,10 @@
 
             self.msg_connect(self.tch_f_decoder, "msgs", self.socket_pdu, "pdus")
             self.msg_connect(self.cch_decoder, "msgs", self.socket_pdu, "pdus")
+            self.msg_connect(self.tch_f_decoder, "voice", self.tch_f_pdu_to_tagged_stream, "pdus")
+            self.connect((self.tch_f_pdu_to_tagged_stream, 0), (self.tch_f_file_sink, 0))    
+            
+
             if self.verbose:
                 self.msg_connect(self.tch_f_decoder, "msgs", self.message_printer, "msgs")
                 self.msg_connect(self.cch_decoder, "msgs", self.message_printer, "msgs")
@@ -274,7 +280,7 @@
         parser, 'Cfile Options', 'Options for decoding cfile input.',
     )
     cfile_options.add_option("-f", "--fc", dest="fc", type="eng_float",
-                             help="Frequency of cfile capture [default=eng_notation.num_to_str(939.4e6)]")
+                             help="Frequency of cfile capture")
     cfile_options.add_option("-a", "--arfcn", dest="arfcn", type="intx",
                              help="Set ARFCN instead of frequency. "
                                   "In some cases you may have to provide the GSM band also")
@@ -285,6 +291,9 @@
     cfile_options.add_option("-s", "--samp-rate", dest="samp_rate", type="eng_float",
                              default=eng_notation.num_to_str(1e6),
                              help="Sample rate of cfile capture [default=%default]")
+    cfile_options.add_option("--ppm", dest="ppm", type="float", default=0,
+                             help="Set frequency offset correction [default=%default]")
+
     parser.add_option_group(cfile_options)
 
     # group decryption options
@@ -327,12 +336,12 @@
     if options.a5 < 0 or options.a5 > 3:
         parser.error("Invalid A5 version\n")
 
-    if options.cfile and (options.fc is None and options.arfcn is None) or (options.fc is not None and options.arfcn is not None):
+    if options.cfile and (options.fc is None and options.arfcn is None):
         print("You haven't provided a frequency or an ARFCN - working without automatic frequency offset correction.\n")
 
     # handle frequency / arfcn input
-    arfcn = 0
-    fc = 939.4e6
+    arfcn = None
+    fc = None
     if options.arfcn:
         if options.band:
             if options.band not in grgsm.arfcn.get_bands():
@@ -363,10 +372,6 @@
                     arfcn = grgsm.arfcn.downlink2arfcn(options.fc, band)
                     break
 
-    # open udp port 4729 to avoid icmp messages
-    #sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
-    #sock.bind(("localhost", 4729))
-
     # instanciate decoder
     tb = grgsm_decoder(timeslot=options.timeslot, subslot=options.subslot, chan_mode=options.chan_mode,
                           burst_file=options.burst_file,
@@ -374,11 +379,9 @@
                           a5=options.a5, a5_kc=kc,
                           speech_file=options.speech_output_file, speech_codec=tch_codecs.get(options.speech_codec),
                           verbose=options.verbose,
-                          print_bursts=options.print_bursts)
+                          print_bursts=options.print_bursts, ppm=options.ppm)
 
     # run
     tb.start()
     tb.wait()
 
-    # we are done, close socket
-    #sock.close()
diff --git a/apps/grgsm_livemon b/apps/grgsm_livemon
index 1d37970..d4376e4 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: Mon Jul 18 18:08:34 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, osr=4):
         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,11 +64,13 @@
         ##################################################
         # Parameters
         ##################################################
+        self.args = args
         self.fc = fc
         self.gain = gain
         self.ppm = ppm
         self.samp_rate = samp_rate
         self.shiftoff = shiftoff
+        self.osr = osr
 
         ##################################################
         # Variables
@@ -109,40 +114,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 +160,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, osr)
+        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 +192,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
 
@@ -209,19 +226,25 @@
 
     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.blocks_rotator_cc_0.set_phase_inc(-2*pi*self.shiftoff/self.samp_rate)
 
     def get_shiftoff(self):
         return self.shiftoff
 
     def set_shiftoff(self, shiftoff):
         self.shiftoff = shiftoff
-        self.blocks_rotator_cc_0.set_phase_inc(-2*pi*self.shiftoff/self.samp_rate)
         self.rtlsdr_source_0.set_center_freq(self.fc_slider-self.shiftoff, 0)
         self.rtlsdr_source_0.set_bandwidth(250e3+abs(self.shiftoff), 0)
+        self.blocks_rotator_cc_0.set_phase_inc(-2*pi*self.shiftoff/self.samp_rate)
+
+    def get_osr(self):
+        return self.osr
+
+    def set_osr(self, osr):
+        self.osr = osr
 
     def get_ppm_slider(self):
         return self.ppm_slider
@@ -246,28 +269,43 @@
         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'))
+    parser.add_option(
+        "", "--osr", dest="osr", type="intx", default=4,
+        help="Set OSR [default=%default]")
+    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, osr=options.osr)
     tb.start()
     tb.show()
 
@@ -276,4 +314,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..6394924 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>
@@ -325,7 +333,7 @@
     </param>
     <param>
       <key>_coordinate</key>
-      <value>(256, 299)</value>
+      <value>(256, 300)</value>
     </param>
     <param>
       <key>_rotation</key>
@@ -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>
@@ -642,9 +642,17 @@
       <value>0</value>
     </param>
     <param>
+      <key>osr</key>
+      <value>osr</value>
+    </param>
+    <param>
       <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 +978,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>
@@ -1026,6 +1026,49 @@
     </param>
     <param>
       <key>_coordinate</key>
+      <value>(1088, 7)</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>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>(712, 11)</value>
     </param>
     <param>
@@ -2644,7 +2687,7 @@
     </param>
     <param>
       <key>_coordinate</key>
-      <value>(16, 227)</value>
+      <value>(8, 237)</value>
     </param>
     <param>
       <key>_rotation</key>
@@ -2854,8 +2897,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..169a9e5 100755
--- a/apps/grgsm_scanner
+++ b/apps/grgsm_scanner
@@ -76,7 +76,7 @@
             samp_rate_in=samp_rate,
         )
         self.gsm_control_channels_decoder_0 = grgsm.control_channels_decoder()
-        self.gsm_clock_offset_control_0 = grgsm.clock_offset_control(fc)
+        self.gsm_clock_offset_control_0 = grgsm.clock_offset_control(fc, samp_rate, osr=4)
         self.gsm_bcch_ccch_demapper_0 = grgsm.gsm_bcch_ccch_demapper(0)
 
         ##################################################
@@ -84,7 +84,7 @@
         ##################################################
         self.msg_connect(self.gsm_bcch_ccch_demapper_0, 'bursts', self, 'bursts')
         self.msg_connect(self.gsm_bcch_ccch_demapper_0, 'bursts', self.gsm_control_channels_decoder_0, 'bursts')
-        self.msg_connect(self.gsm_clock_offset_control_0, 'ppm', self.gsm_input_0, 'ppm_in')
+        self.msg_connect(self.gsm_clock_offset_control_0, 'ctrl', self.gsm_input_0, 'ctrl_in')
         self.msg_connect(self.gsm_control_channels_decoder_0, 'msgs', self, 'msgs')
         self.msg_connect(self.gsm_receiver_0, 'C0', self.gsm_bcch_ccch_demapper_0, 'bursts')
         self.msg_connect(self.gsm_receiver_0, 'measurements', self.gsm_clock_offset_control_0, 'measurements')
diff --git a/apps/helpers/grgsm_capture.py b/apps/helpers/grgsm_capture.py
index 51c13ac..aa3a15c 100755
--- a/apps/helpers/grgsm_capture.py
+++ b/apps/helpers/grgsm_capture.py
@@ -86,7 +86,7 @@
                 fc=fc,
                 samp_rate_in=samp_rate,
             )
-            self.gsm_clock_offset_control = grgsm.clock_offset_control(fc-shiftoff)
+            self.gsm_clock_offset_control = grgsm.clock_offset_control(fc-shiftoff, sample_rate, osr=4)
 
         if self.burst_file:
             self.gsm_burst_file_sink = grgsm.burst_file_sink(self.burst_file)
diff --git a/build.sh b/build.sh
deleted file mode 100755
index 8383aaf..0000000
--- a/build.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-# First, get into the right directory
-THISPATH=$(dirname "$BASH_SOURCE")
-cd $THISPATH
-
-# Now, we check to see that the version env var is set
-${CPACK_PACKAGE_VERSION:?"Need to set CPACK_PACKAGE_VERSION env var!"}
-export $CPACK_DEBIAN_PACKAGE_ARCHITECTURE=`dpkg --print-architecture`
-
-# OK, now we get down to the business of building...
-rm -rf ./build
-mkdir build
-cd build
-cmake ..
-make package
-cpack -G DEB
-mv ./*.deb ../installer-packages
-echo "If you've gotten to this point, the package has been built"
-echo "and exists at "$THISPATH"/installer-packages"
-echo "Don't forget to add and commit the new package, and tag the commit!"
diff --git a/debian/build-package b/debian/build-package
index d0d822a..269590b 100755
--- a/debian/build-package
+++ b/debian/build-package
@@ -1,8 +1,11 @@
 #!/bin/bash
+VERSION=0.40
+
 cd ../..
 
-tar -acf gr-gsm_0.3.orig.tar.gz gr-gsm
+tar -acf gr-gsm_${VERSION}.orig.tar.gz gr-gsm
 cd gr-gsm
 debuild -S -sa
+#pdebuild
 cd ..
-dput ppa:ptrkrysik/gr-gsm gr-gsm_0.3-0ppa0_source.changes
+dput ppa:ptrkrysik/gr-gsm gr-gsm_${VERSION}-0ppa0_source.changes
diff --git a/debian/changelog b/debian/changelog
index 2f7a22b..11c86a9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-gr-gsm (0.3-0ppa0) xenial; urgency=low
+gr-gsm (0.40-0ppa0) xenial; urgency=low
 
   * Initial upload!
 
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..f11c82a
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
\ No newline at end of file
diff --git a/debian/control b/debian/control
index d4e5661..a513300 100644
--- a/debian/control
+++ b/debian/control
@@ -1,13 +1,23 @@
 Source: gr-gsm
-Section: devel
+Section: libdevel
 Priority: optional
-Maintainer: Your Name <your.email@some.where>
-Build-Depends: cmake, build-essential, python-scipy, gnuradio-dev, gr-osmosdr, libosmocore-dev
+Maintainer: Piotr Krysik <ptrkrysik@gmail.com>
+Build-Depends: cmake,
+               debhelper (>= 9.0.0~),
+               pkg-config,
+               python-scipy,
+               gnuradio-dev,
+               libosmocore-dev,
+               python-dev,
+               swig
+X-Python-Version: >= 2.7, << 2.8
+Standards-Version: 3.9.7
+Homepage: http://github.com/ptrkrysik/gr-gsm/
+Vcs-Git: git://github.com/ptrkrysik/gr-gsm.git
+Vcs-Browser: https://github.com/ptrkrysik/gr-gsm/
 
-Homepage: http://www.yourhomepage.org
 Package: gr-gsm
 Architecture: any
-Depends:  ${shlibs:Depends}, ${misc:Depends}, gnuradio, gr-osmosdr, python-scipy
-Description: First test-package
- Long description of greet-the-world.
- It can span multiple lines!
+Pre-Depends: ${misc:Pre-Depends}
+Depends: gnuradio, gr-osmosdr, ${misc:Depends}, ${python:Depends}, ${shlibs:Depends}
+Description: Gnuradio blocks and tools for receiving GSM transmissions
diff --git a/debian/rules b/debian/rules
index 6b44c5b..cb59406 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,27 +1,15 @@
 #!/usr/bin/make -f
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+export DEB_HOST_MULTIARCH
 
-BUILDDIR = build
+%:
+	dh $@ --with python2 --parallel
 
-# secondly called by launchpad
-build:
-	mkdir $(BUILDDIR);
-	cd $(BUILDDIR); cmake -DCMAKE_INSTALL_PREFIX=../debian/tmp/usr ..
-	make -C $(BUILDDIR)
+override_dh_auto_configure:
+	dh_auto_configure -- -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" -DPythonLibs_FIND_VERSION:STRING="2.7" -DPYTHON_EXECUTABLE:STRING="/usr/bin/python"
 
-# thirdly called by launchpad
-binary: binary-indep binary-arch
+override_dh_auto_install:
+	dh_auto_install
+	rm -f debian/gr-gsm/usr/lib/python2.7/dist-packages/grgsm/*pyc
+	rm -f debian/gr-gsm/usr/lib/python2.7/dist-packages/grgsm/*pyo
 
-binary-indep:
-	# nothing to be done
-
-binary-arch:
-	cd $(BUILDDIR); cmake -P cmake_install.cmake
-	mkdir debian/tmp/DEBIAN
-	dpkg-gencontrol -pgr-gsm
-	dpkg --build debian/tmp ..
-
-# firstly called by launchpad
-clean:
-	rm -rf $(BUILDDIR)
-
-.PHONY: binary binary-arch binary-indep clean
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..46ebe02
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
\ No newline at end of file
diff --git a/examples b/examples
index 9446043..f4f7c95 160000
--- a/examples
+++ b/examples
@@ -1 +1 @@
-Subproject commit 9446043efe0fe6883e4e962261230c9034ac71a9
+Subproject commit f4f7c95b491fd6ce0b47d4f16b5019d69e5e22e8
diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt
index 47dfc89..2b94539 100644
--- a/grc/CMakeLists.txt
+++ b/grc/CMakeLists.txt
@@ -24,6 +24,5 @@
 add_subdirectory(flow_control)
 add_subdirectory(misc_utils)
 install(FILES
-    gsm_block_tree.xml
-    grgsm_msg_to_tag.xml DESTINATION share/gnuradio/grc/blocks
+    gsm_block_tree.xml DESTINATION share/gnuradio/grc/blocks
 )
diff --git a/grc/decoding/gsm_tch_f_decoder.xml b/grc/decoding/gsm_tch_f_decoder.xml
index 632162f..3d1152e 100644
--- a/grc/decoding/gsm_tch_f_decoder.xml
+++ b/grc/decoding/gsm_tch_f_decoder.xml
@@ -3,7 +3,7 @@
   <name>TCH/F decoder</name>
   <key>gsm_tch_f_decoder</key>
   <import>import grgsm</import>
-  <make>grgsm.tch_f_decoder($mode, $file, $boundary_check)</make>
+  <make>grgsm.tch_f_decoder($mode, $boundary_check)</make>
 
   <param>
     <name>TCH coding mode</name>
@@ -51,15 +51,9 @@
     </option>
   </param>
   <param>
-    <name>destination file</name>
-    <key>file</key>
-    <value>/tmp/speech.gsm</value>
-    <type>file_open</type>
-  </param>
-  <param>
     <name>Voice boundary detection</name>
     <key>boundary_check</key>
-    <value>True</value>
+    <value>False</value>
     <type>bool</type>
     <option>
       <name>False</name>
@@ -80,7 +74,12 @@
     <type>message</type>
     <optional>1</optional>
   </source>
-  
+  <source>
+    <name>voice</name>
+    <type>message</type>
+    <optional>1</optional>
+  </source>
+    
   <doc>
 If "Voice boundary detection" is enabled, then only bursts are decoded as voice where
 
diff --git a/grc/demapping/gsm_bcch_ccch_demapper.xml b/grc/demapping/gsm_bcch_ccch_demapper.xml
index ff392f1..239dcc9 100644
--- a/grc/demapping/gsm_bcch_ccch_demapper.xml
+++ b/grc/demapping/gsm_bcch_ccch_demapper.xml
@@ -1,5 +1,5 @@
 <block>
-  <name>BCCH + CCCH demapper</name>
+  <name>BCCH + CCCH Demapper</name>
   <key>gsm_bcch_ccch_demapper</key>
   <category></category>
   <import>import grgsm</import>
diff --git a/grc/demapping/gsm_bcch_ccch_sdcch4_demapper.xml b/grc/demapping/gsm_bcch_ccch_sdcch4_demapper.xml
index 94a433e..6c6845a 100644
--- a/grc/demapping/gsm_bcch_ccch_sdcch4_demapper.xml
+++ b/grc/demapping/gsm_bcch_ccch_sdcch4_demapper.xml
@@ -1,5 +1,5 @@
 <block>
-  <name>BCCH + CCCH + SDCCH/4 demapper</name>
+  <name>BCCH + CCCH + SDCCH/4 Demapper</name>
   <key>gsm_bcch_ccch_sdcch4_demapper</key>
   <category></category>
   <import>import grgsm</import>
diff --git a/grc/demapping/gsm_sdcch8_demapper.xml b/grc/demapping/gsm_sdcch8_demapper.xml
index 7507065..0c62a46 100644
--- a/grc/demapping/gsm_sdcch8_demapper.xml
+++ b/grc/demapping/gsm_sdcch8_demapper.xml
@@ -1,5 +1,5 @@
 <block>
-  <name>SDCCH/8 demapper</name>
+  <name>SDCCH/8 Demapper</name>
   <key>gsm_sdcch8_demapper</key>
   <category></category>
   <import>import grgsm</import>
diff --git a/grc/demapping/gsm_tch_f_chans_demapper.xml b/grc/demapping/gsm_tch_f_chans_demapper.xml
index 2a3f443..deb2187 100644
--- a/grc/demapping/gsm_tch_f_chans_demapper.xml
+++ b/grc/demapping/gsm_tch_f_chans_demapper.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>TCH/F chans demapper</name>
+  <name>TCH/F Demapper</name>
   <key>gsm_tch_f_chans_demapper</key>
   <import>import grgsm</import>
   <make>grgsm.tch_f_chans_demapper($timeslot_nr)</make>
diff --git a/grc/demapping/gsm_universal_ctrl_chans_demapper.xml b/grc/demapping/gsm_universal_ctrl_chans_demapper.xml
index f173752..dcad1ae 100644
--- a/grc/demapping/gsm_universal_ctrl_chans_demapper.xml
+++ b/grc/demapping/gsm_universal_ctrl_chans_demapper.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Universal ctrl chans demapper</name>
+  <name>Universal Control Channels Demapper</name>
   <key>gsm_universal_ctrl_chans_demapper</key>
   <import>import grgsm</import>
   <make>grgsm.universal_ctrl_chans_demapper($timeslot_nr, $downlink_starts_fn_mod51, $downlink_channel_types, $downlink_subslots, $uplink_starts_fn_mod51, $uplink_channel_types, $uplink_subslots)</make>
diff --git a/grc/flow_control/gsm_burst_fnr_filter.xml b/grc/flow_control/gsm_burst_fnr_filter.xml
index d09b6e6..7b27583 100644
--- a/grc/flow_control/gsm_burst_fnr_filter.xml
+++ b/grc/flow_control/gsm_burst_fnr_filter.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Burst framenumber filter</name>
+  <name>Burst Framenumber Filter</name>
   <key>gsm_burst_fnr_filter</key>
   <import>import grgsm</import>
   <make>grgsm.burst_fnr_filter($mode, $fnr)</make>
diff --git a/grc/flow_control/gsm_burst_sdcch_subslot_filter.xml b/grc/flow_control/gsm_burst_sdcch_subslot_filter.xml
index 81ae287..ddfcb3b 100644
--- a/grc/flow_control/gsm_burst_sdcch_subslot_filter.xml
+++ b/grc/flow_control/gsm_burst_sdcch_subslot_filter.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Burst SDCCH subslot filter</name>
+  <name>Burst SDCCH Subslot Filter</name>
   <key>gsm_burst_sdcch_subslot_filter</key>
   <import>import grgsm</import>
   <make>grgsm.burst_sdcch_subslot_filter($mode, $subslot)</make>
diff --git a/grc/flow_control/gsm_burst_sdcch_subslot_splitter.xml b/grc/flow_control/gsm_burst_sdcch_subslot_splitter.xml
index 4812d0b..62415e7 100644
--- a/grc/flow_control/gsm_burst_sdcch_subslot_splitter.xml
+++ b/grc/flow_control/gsm_burst_sdcch_subslot_splitter.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Burst SDCCH subslot splitter</name>
+  <name>Burst SDCCH Subslot Splitter</name>
   <key>gsm_burst_sdcch_subslot_splitter</key>
   <import>import grgsm</import>
   <make>grgsm.burst_sdcch_subslot_splitter(
diff --git a/grc/flow_control/gsm_burst_timeslot_filter.xml b/grc/flow_control/gsm_burst_timeslot_filter.xml
index 8af2b7b..b900375 100644
--- a/grc/flow_control/gsm_burst_timeslot_filter.xml
+++ b/grc/flow_control/gsm_burst_timeslot_filter.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Burst timeslot filter</name>
+  <name>Burst Timeslot Filter</name>
   <key>gsm_burst_timeslot_filter</key>
   <import>import grgsm</import>
   <make>grgsm.burst_timeslot_filter($timeslot)</make>
diff --git a/grc/flow_control/gsm_burst_timeslot_splitter.xml b/grc/flow_control/gsm_burst_timeslot_splitter.xml
index 91db4db..4f6159e 100644
--- a/grc/flow_control/gsm_burst_timeslot_splitter.xml
+++ b/grc/flow_control/gsm_burst_timeslot_splitter.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Burst timeslot splitter</name>
+  <name>Burst Timeslot Splitter</name>
   <key>gsm_burst_timeslot_splitter</key>
   <import>import grgsm</import>
   <make>grgsm.burst_timeslot_splitter()</make>
diff --git a/grc/flow_control/gsm_dummy_burst_filter.xml b/grc/flow_control/gsm_dummy_burst_filter.xml
index 046abbf..126e4fe 100644
--- a/grc/flow_control/gsm_dummy_burst_filter.xml
+++ b/grc/flow_control/gsm_dummy_burst_filter.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <block>
-  <name>Dummy burst filter</name>
+  <name>Dummy Burst Filter</name>
   <key>gsm_dummy_burst_filter</key>
   <import>import grgsm</import>
   <make>grgsm.dummy_burst_filter()</make>
diff --git a/grc/grgsm_msg_to_tag.xml b/grc/grgsm_msg_to_tag.xml
deleted file mode 100644
index fab2c6c..0000000
--- a/grc/grgsm_msg_to_tag.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<block>
-  <name>msg_to_tag</name>
-  <key>grgsm_msg_to_tag</key>
-  <category>grgsm</category>
-  <import>import grgsm</import>
-  <make>grgsm.msg_to_tag()</make>
-  <!-- Make one 'param' node for every Parameter you want settable from the GUI.
-       Sub-nodes:
-       * name
-       * key (makes the value accessible as $keyname, e.g. in the make node)
-       * type -->
-  <param>
-    <name>...</name>
-    <key>...</key>
-    <type>...</type>
-  </param>
-
-  <!-- Make one 'sink' node per input. Sub-nodes:
-       * name (an identifier for the GUI)
-       * type
-       * vlen
-       * optional (set to 1 for optional inputs) -->
-  <sink>
-    <name>in</name>
-    <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
-  </sink>
-
-  <!-- Make one 'source' node per output. Sub-nodes:
-       * name (an identifier for the GUI)
-       * type
-       * vlen
-       * optional (set to 1 for optional inputs) -->
-  <source>
-    <name>out</name>
-    <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
-  </source>
-</block>
diff --git a/grc/gsm_block_tree.xml b/grc/gsm_block_tree.xml
index 0b15562..69120f0 100644
--- a/grc/gsm_block_tree.xml
+++ b/grc/gsm_block_tree.xml
@@ -58,9 +58,10 @@
       <block>gsm_extract_system_info</block>
       <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_msg_to_tag.xml</block>
       <block>gsm_tmsi_dumper</block>
     </cat>
   </cat>
diff --git a/grc/misc_utils/CMakeLists.txt b/grc/misc_utils/CMakeLists.txt
index 99985a1..7bdf894 100644
--- a/grc/misc_utils/CMakeLists.txt
+++ b/grc/misc_utils/CMakeLists.txt
@@ -21,13 +21,14 @@
     gsm_extract_system_info.xml
     gsm_extract_immediate_assignment.xml
     gsm_controlled_rotator_cc.xml
-    gsm_controlled_const_source_f.xml
     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
deleted file mode 100644
index c94677b..0000000
--- a/grc/misc_utils/gsm_clock_offset_corrector.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<block>
-  <name>Clock offset corrector</name>
-  <key>gsm_clock_offset_corrector</key>
-  <import>import grgsm</import>
-  <make>grgsm.clock_offset_corrector(
-    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>in</name>
-    <type>complex</type>
-    <vlen>1</vlen>
-  </sink>
-  <sink>
-    <name>ppm_in</name>
-    <type>message</type>
-    <optional>True</optional>
-  </sink>
-  <source>
-    <name>out</name>
-    <type>complex</type>
-    <vlen>1</vlen>
-  </source>
-  <doc>Piotr Krysik</doc>
-</block>
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..bcec98e
--- /dev/null
+++ b/grc/misc_utils/gsm_clock_offset_corrector_tagged.xml
@@ -0,0 +1,57 @@
+<block>
+  <name>Clock Offset Corrector Tagged</name>
+  <key>gsm_clock_offset_corrector_tagged</key>
+  <import>import grgsm</import>
+  <make>grgsm.clock_offset_corrector_tagged(
+    fc=$fc,
+    samp_rate_in=$samp_rate_in,
+    ppm=$ppm,
+    osr=$osr
+)</make>
+  <callback>set_fc($fc)</callback>
+  <callback>set_ppm($ppm)</callback>
+  <callback>set_samp_rate_in($samp_rate_in)</callback>
+  <callback>set_osr($osr)</callback>
+  <param>
+    <name>fc</name>
+    <key>fc</key>
+    <value>936.6e6</value>
+    <type>raw</type>
+  </param>
+  <param>
+    <name>ppm</name>
+    <key>ppm</key>
+    <value>0</value>
+    <type>raw</type>
+  </param>
+  <param>
+    <name>samp_rate_in</name>
+    <key>samp_rate_in</key>
+    <value>1625000.0/6.0*4.0</value>
+    <type>raw</type>
+  </param>
+  <param>
+    <name>OSR</name>
+    <key>osr</key>
+    <value>osr</value>
+    <type>raw</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>
+</block>
diff --git a/grc/misc_utils/gsm_controlled_const_source_f.xml b/grc/misc_utils/gsm_controlled_const_source_f.xml
deleted file mode 100644
index 10ae06f..0000000
--- a/grc/misc_utils/gsm_controlled_const_source_f.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<block>
-  <name>Controlled const source</name>
-  <key>gsm_controlled_const_source_f</key>
-  <import>import grgsm</import>
-  <make>grgsm.controlled_const_source_f($constant)</make>
-  <callback>set_constant($constant)</callback>
-  
-  <param>
-    <name>constant</name>
-    <key>constant</key>
-    <value>0</value>
-    <type>float</type>
-  </param>
-
-  <sink>
-    <name>constant_msg</name>
-    <type>message</type>
-    <optional>1</optional>
-  </sink>
-
-  <source>
-    <name>out</name>
-    <type>float</type>
-  </source>
-</block>
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..09ac422 100644
--- a/grc/misc_utils/gsm_controlled_rotator_cc.xml
+++ b/grc/misc_utils/gsm_controlled_rotator_cc.xml
@@ -1,34 +1,20 @@
 <?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>
+  <make>grgsm.controlled_rotator_cc($phase_inc)</make>
   <callback>set_phase_inc($phase_inc)</callback>
-  <callback>set_samp_rate($samp_rate)</callback>
   <param>
     <name>phase_inc</name>
     <key>phase_inc</key>
     <value>0</value>
     <type>real</type>
   </param>
-
-  <param>
-    <name>samp_rate</name>
-    <key>samp_rate</key>
-    <value>samp_rate</value>
-    <type>real</type>
-  </param>
-
   <sink>
     <name>in</name>
     <type>complex</type>
   </sink>
-  <sink>
-    <name>phase_inc</name>
-    <type>float</type>
-  </sink>
-  
   <source>
     <name>out</name>
     <type>complex</type>
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..17378ea 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, $osr)</make>
   <callback></callback>
   <param>
     <name>fc</name>
@@ -11,6 +11,19 @@
     <value>fc</value>
     <type>float</type>
   </param>
+  <param>
+    <name>OSR</name>
+    <key>osr</key>
+    <value>osr</value>
+    <type>int</type>
+  </param>
+
+  <param>
+    <name>samp_rate</name>
+    <key>samp_rate</key>
+    <value>samp_rate</value>
+    <type>float</type>
+  </param>
 
   <sink>
     <name>measurements</name>
@@ -18,7 +31,7 @@
   </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.grc b/hier_blocks/misc_utils/gsm_clock_offset_corrector_tagged.grc
similarity index 68%
rename from hier_blocks/misc_utils/gsm_clock_offset_corrector.grc
rename to hier_blocks/misc_utils/gsm_clock_offset_corrector_tagged.grc
index 2222d7e..395440b 100644
--- a/hier_blocks/misc_utils/gsm_clock_offset_corrector.grc
+++ b/hier_blocks/misc_utils/gsm_clock_offset_corrector_tagged.grc
@@ -22,7 +22,7 @@
     </param>
     <param>
       <key>description</key>
-      <value></value>
+      <value>Clock offset corrector with blocks that use tags to switch offsets</value>
     </param>
     <param>
       <key>_enabled</key>
@@ -46,7 +46,7 @@
     </param>
     <param>
       <key>id</key>
-      <value>clock_offset_corrector</value>
+      <value>clock_offset_corrector_tagged</value>
     </param>
     <param>
       <key>max_nouts</key>
@@ -78,7 +78,7 @@
     </param>
     <param>
       <key>title</key>
-      <value>Clock offset corrector</value>
+      <value>Clock Offset Corrector Tagged</value>
     </param>
   </block>
   <block>
@@ -93,7 +93,34 @@
     </param>
     <param>
       <key>_coordinate</key>
-      <value>(736, 19)</value>
+      <value>(688, 21)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>gsm_symb_rate</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>1625000.0/6.0</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>(808, 21)</value>
     </param>
     <param>
       <key>_rotation</key>
@@ -105,85 +132,22 @@
     </param>
     <param>
       <key>value</key>
-      <value>samp_rate_in</value>
+      <value>osr*gsm_symb_rate</value>
     </param>
   </block>
   <block>
-    <key>blocks_add_const_vxx</key>
-    <param>
-      <key>alias</key>
-      <value></value>
-    </param>
+    <key>pad_source</key>
     <param>
       <key>comment</key>
       <value></value>
     </param>
     <param>
-      <key>const</key>
-      <value>samp_rate_in/samp_rate_out</value>
-    </param>
-    <param>
-      <key>affinity</key>
-      <value></value>
-    </param>
-    <param>
-      <key>_enabled</key>
-      <value>0</value>
-    </param>
-    <param>
-      <key>_coordinate</key>
-      <value>(552, 331)</value>
-    </param>
-    <param>
-      <key>_rotation</key>
-      <value>0</value>
-    </param>
-    <param>
-      <key>id</key>
-      <value>blocks_add_const_vxx_0</value>
-    </param>
-    <param>
-      <key>type</key>
-      <value>float</value>
-    </param>
-    <param>
-      <key>maxoutbuf</key>
-      <value>0</value>
-    </param>
-    <param>
-      <key>minoutbuf</key>
-      <value>0</value>
-    </param>
-    <param>
-      <key>vlen</key>
-      <value>1</value>
-    </param>
-  </block>
-  <block>
-    <key>blocks_multiply_const_vxx</key>
-    <param>
-      <key>alias</key>
-      <value></value>
-    </param>
-    <param>
-      <key>comment</key>
-      <value></value>
-    </param>
-    <param>
-      <key>const</key>
-      <value>fc/samp_rate_out*(2*math.pi)/1e6</value>
-    </param>
-    <param>
-      <key>affinity</key>
-      <value></value>
-    </param>
-    <param>
       <key>_enabled</key>
       <value>True</value>
     </param>
     <param>
       <key>_coordinate</key>
-      <value>(432, 220)</value>
+      <value>(32, 244)</value>
     </param>
     <param>
       <key>_rotation</key>
@@ -191,70 +155,23 @@
     </param>
     <param>
       <key>id</key>
-      <value>blocks_multiply_const_vxx_0</value>
+      <value>ctrl</value>
     </param>
     <param>
-      <key>type</key>
-      <value>float</value>
+      <key>label</key>
+      <value>ctrl</value>
     </param>
     <param>
-      <key>maxoutbuf</key>
-      <value>0</value>
-    </param>
-    <param>
-      <key>minoutbuf</key>
-      <value>0</value>
-    </param>
-    <param>
-      <key>vlen</key>
+      <key>num_streams</key>
       <value>1</value>
     </param>
-  </block>
-  <block>
-    <key>blocks_multiply_const_vxx</key>
     <param>
-      <key>alias</key>
-      <value></value>
-    </param>
-    <param>
-      <key>comment</key>
-      <value></value>
-    </param>
-    <param>
-      <key>const</key>
-      <value>1.0e-6*samp_rate_in/samp_rate_out</value>
-    </param>
-    <param>
-      <key>affinity</key>
-      <value></value>
-    </param>
-    <param>
-      <key>_enabled</key>
-      <value>0</value>
-    </param>
-    <param>
-      <key>_coordinate</key>
-      <value>(392, 331)</value>
-    </param>
-    <param>
-      <key>_rotation</key>
-      <value>0</value>
-    </param>
-    <param>
-      <key>id</key>
-      <value>blocks_multiply_const_vxx_0_0</value>
+      <key>optional</key>
+      <value>True</value>
     </param>
     <param>
       <key>type</key>
-      <value>float</value>
-    </param>
-    <param>
-      <key>maxoutbuf</key>
-      <value>0</value>
-    </param>
-    <param>
-      <key>minoutbuf</key>
-      <value>0</value>
+      <value>message</value>
     </param>
     <param>
       <key>vlen</key>
@@ -305,7 +222,7 @@
     </param>
   </block>
   <block>
-    <key>fractional_resampler_xx</key>
+    <key>gsm_controlled_fractional_resampler_cc</key>
     <param>
       <key>alias</key>
       <value></value>
@@ -320,11 +237,11 @@
     </param>
     <param>
       <key>_enabled</key>
-      <value>0</value>
+      <value>1</value>
     </param>
     <param>
       <key>_coordinate</key>
-      <value>(592, 537)</value>
+      <value>(344, 197)</value>
     </param>
     <param>
       <key>_rotation</key>
@@ -332,7 +249,7 @@
     </param>
     <param>
       <key>id</key>
-      <value>fractional_resampler_xx_0</value>
+      <value>gsm_controlled_fractional_resampler_cc_0</value>
     </param>
     <param>
       <key>maxoutbuf</key>
@@ -348,54 +265,7 @@
     </param>
     <param>
       <key>resamp_ratio</key>
-      <value>samp_rate_in/samp_rate_out</value>
-    </param>
-    <param>
-      <key>type</key>
-      <value>complex</value>
-    </param>
-  </block>
-  <block>
-    <key>gsm_controlled_const_source_f</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>(184, 220)</value>
-    </param>
-    <param>
-      <key>_rotation</key>
-      <value>0</value>
-    </param>
-    <param>
-      <key>id</key>
-      <value>gsm_controlled_const_source_f_0</value>
-    </param>
-    <param>
-      <key>maxoutbuf</key>
-      <value>0</value>
-    </param>
-    <param>
-      <key>minoutbuf</key>
-      <value>0</value>
-    </param>
-    <param>
-      <key>constant</key>
-      <value>ppm</value>
+      <value>(1-ppm/1.0e6)*(samp_rate_in/samp_rate_out)</value>
     </param>
   </block>
   <block>
@@ -418,7 +288,7 @@
     </param>
     <param>
       <key>_coordinate</key>
-      <value>(952, 193)</value>
+      <value>(600, 204)</value>
     </param>
     <param>
       <key>_rotation</key>
@@ -438,11 +308,46 @@
     </param>
     <param>
       <key>phase_inc</key>
+      <value>ppm/1.0e6*2*math.pi*fc/samp_rate_out</value>
+    </param>
+  </block>
+  <block>
+    <key>gsm_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>samp_rate</key>
-      <value>samp_rate_out</value>
+      <key>id</key>
+      <value>gsm_msg_to_tag_0</value>
+    </param>
+    <param>
+      <key>maxoutbuf</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>minoutbuf</key>
+      <value>0</value>
     </param>
   </block>
   <block>
@@ -477,6 +382,49 @@
     </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>(584, 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>
@@ -488,7 +436,7 @@
     </param>
     <param>
       <key>_coordinate</key>
-      <value>(1168, 204)</value>
+      <value>(776, 204)</value>
     </param>
     <param>
       <key>_rotation</key>
@@ -606,49 +554,6 @@
     </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>ppm_in</value>
-    </param>
-    <param>
-      <key>label</key>
-      <value>ppm_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>
@@ -691,83 +596,16 @@
       <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>blocks_add_const_vxx_0</source_block_id>
-    <sink_block_id>fractional_resampler_xx_0</sink_block_id>
-    <source_key>0</source_key>
-    <sink_key>1</sink_key>
+    <source_block_id>ctrl</source_block_id>
+    <sink_block_id>gsm_msg_to_tag_0</sink_block_id>
+    <source_key>out</source_key>
+    <sink_key>msg</sink_key>
   </connection>
   <connection>
-    <source_block_id>blocks_multiply_const_vxx_0</source_block_id>
+    <source_block_id>gsm_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>1</sink_key>
-  </connection>
-  <connection>
-    <source_block_id>blocks_multiply_const_vxx_0_0</source_block_id>
-    <sink_block_id>blocks_add_const_vxx_0</sink_block_id>
-    <source_key>0</source_key>
-    <sink_key>0</sink_key>
-  </connection>
-  <connection>
-    <source_block_id>fractional_resampler_xx_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>gsm_controlled_const_source_f_0</source_block_id>
-    <sink_block_id>blocks_multiply_const_vxx_0</sink_block_id>
-    <source_key>0</source_key>
-    <sink_key>0</sink_key>
-  </connection>
-  <connection>
-    <source_block_id>gsm_controlled_const_source_f_0</source_block_id>
-    <sink_block_id>blocks_multiply_const_vxx_0_0</sink_block_id>
-    <source_key>0</source_key>
     <sink_key>0</sink_key>
   </connection>
   <connection>
@@ -777,21 +615,15 @@
     <sink_key>0</sink_key>
   </connection>
   <connection>
-    <source_block_id>pad_source_0</source_block_id>
-    <sink_block_id>fractional_resampler_xx_0</sink_block_id>
+    <source_block_id>gsm_msg_to_tag_0</source_block_id>
+    <sink_block_id>gsm_controlled_fractional_resampler_cc_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_controlled_rotator_cc_0</sink_block_id>
+    <sink_block_id>gsm_msg_to_tag_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_controlled_const_source_f_0</sink_block_id>
-    <source_key>out</source_key>
-    <sink_key>constant_msg</sink_key>
-  </connection>
 </flow_graph>
diff --git a/hier_blocks/receiver/gsm_input.grc b/hier_blocks/receiver/gsm_input.grc
index 685f0b2..3aa032b 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,52 @@
       <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>
+      <key>_coordinate</key>
+      <value>(752, 21)</value>
     </param>
     <param>
-      <key>alias</key>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>id</key>
+      <value>gsm_symb_rate</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>1625000.0/6.0</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>(632, 19)</value>
     </param>
@@ -91,116 +126,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>gsm_symb_rate*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 +200,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 +236,29 @@
       <value></value>
     </param>
     <param>
-      <key>minoutbuf</key>
+      <key>_enabled</key>
       <value>0</value>
     </param>
     <param>
+      <key>_coordinate</key>
+      <value>(488, 281)</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,117 +268,51 @@
       <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>(232, 199)</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>
+      <key>osr</key>
+      <value>osr</value>
     </param>
     <param>
       <key>fc</key>
@@ -505,36 +326,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, 178)</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, 220)</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 +630,27 @@
     <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>gsm_clock_offset_corrector_tagged_0</source_block_id>
+    <sink_block_id>low_pass_filter_0_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>low_pass_filter_0_0</source_block_id>
+    <sink_block_id>pad_sink_0</sink_block_id>
     <source_key>0</source_key>
-    <sink_key>ppm_in</sink_key>
+    <sink_key>0</sink_key>
+  </connection>
+  <connection>
+    <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>0</sink_key>
   </connection>
 </flow_graph>
diff --git a/include/grgsm/CMakeLists.txt b/include/grgsm/CMakeLists.txt
index 50788ae..dc9b191 100644
--- a/include/grgsm/CMakeLists.txt
+++ b/include/grgsm/CMakeLists.txt
@@ -23,8 +23,7 @@
 install(FILES
     plotting.hpp
     api.h
-    gsmtap.h
-    msg_to_tag.h DESTINATION include/grgsm
+    gsmtap.h DESTINATION include/grgsm
 )
 
 add_subdirectory(decoding)
diff --git a/include/grgsm/decoding/tch_f_decoder.h b/include/grgsm/decoding/tch_f_decoder.h
index 18a1baa..93fe971 100644
--- a/include/grgsm/decoding/tch_f_decoder.h
+++ b/include/grgsm/decoding/tch_f_decoder.h
@@ -62,7 +62,7 @@
        * class. gsm::tch_f_decoder::make is the public interface for
        * creating new instances.
        */
-      static sptr make(tch_mode mode, const std::string &file, bool boundary_check=true);
+      static sptr make(tch_mode mode, bool boundary_check=false);
 
     };
 
diff --git a/include/grgsm/misc_utils/CMakeLists.txt b/include/grgsm/misc_utils/CMakeLists.txt
index d85ac21..d21dcca 100644
--- a/include/grgsm/misc_utils/CMakeLists.txt
+++ b/include/grgsm/misc_utils/CMakeLists.txt
@@ -29,7 +29,8 @@
     extract_system_info.h
     extract_immediate_assignment.h
     controlled_rotator_cc.h
-    controlled_const_source_f.h
     message_printer.h
-    tmsi_dumper.h DESTINATION include/grgsm/misc_utils
+    tmsi_dumper.h
+    msg_to_tag.h
+    controlled_fractional_resampler_cc.h DESTINATION include/grgsm/misc_utils
 )
diff --git a/include/grgsm/misc_utils/controlled_const_source_f.h b/include/grgsm/misc_utils/controlled_const_source_f.h
deleted file mode 100644
index 235c731..0000000
--- a/include/grgsm/misc_utils/controlled_const_source_f.h
+++ /dev/null
@@ -1,58 +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.
- */
-
-#ifndef INCLUDED_GSM_CONTROLLED_CONST_SOURCE_F_H
-#define INCLUDED_GSM_CONTROLLED_CONST_SOURCE_F_H
-
-#include <grgsm/api.h>
-#include <gnuradio/sync_block.h>
-
-namespace gr {
-  namespace gsm {
-
-    /*!
-     * \brief <+description of block+>
-     * \ingroup gsm
-     *
-     */
-    class GRGSM_API controlled_const_source_f : virtual public gr::sync_block
-    {
-     public:
-      typedef boost::shared_ptr<controlled_const_source_f> sptr;
-
-      /*!
-       * \brief Return a shared_ptr to a new instance of gsm::controlled_const_source_f.
-       *
-       * To avoid accidental use of raw pointers, gsm::controlled_const_source_f's
-       * constructor is in a private implementation
-       * class. gsm::controlled_const_source_f::make is the public interface for
-       * creating new instances.
-       */
-      static sptr make(float constant);
-      virtual void set_constant(float constant) = 0;
-    };
-
-  } // namespace gsm
-} // namespace gr
-
-#endif /* INCLUDED_GSM_CONTROLLED_CONST_SOURCE_F_H */
-
diff --git a/include/grgsm/misc_utils/controlled_fractional_resampler_cc.h b/include/grgsm/misc_utils/controlled_fractional_resampler_cc.h
new file mode 100644
index 0000000..9eeb393
--- /dev/null
+++ b/include/grgsm/misc_utils/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/misc_utils/controlled_rotator_cc.h b/include/grgsm/misc_utils/controlled_rotator_cc.h
index 8b0ad8d..8c38eff 100644
--- a/include/grgsm/misc_utils/controlled_rotator_cc.h
+++ b/include/grgsm/misc_utils/controlled_rotator_cc.h
@@ -48,10 +48,10 @@
        * class. gsm::controlled_rotator_cc::make is the public interface for
        * creating new instances.
        */
-      static sptr make(double phase_inc, double samp_rate);
+      static sptr make(double phase_inc);
       
       virtual void set_phase_inc(double phase_inc) = 0;
-      virtual void set_samp_rate(double samp_rate) = 0;
+//      virtual void set_samp_rate(double samp_rate) = 0;
     };
 
   } // namespace gsm
diff --git a/include/grgsm/msg_to_tag.h b/include/grgsm/misc_utils/msg_to_tag.h
similarity index 98%
rename from include/grgsm/msg_to_tag.h
rename to include/grgsm/misc_utils/msg_to_tag.h
index 3d63460..69232fc 100644
--- a/include/grgsm/msg_to_tag.h
+++ b/include/grgsm/misc_utils/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..c4ea8b1 100644
--- a/include/grgsm/receiver/clock_offset_control.h
+++ b/include/grgsm/receiver/clock_offset_control.h
@@ -49,8 +49,10 @@
        * 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, unsigned int osr=4);
+      virtual void set_fc(float fc) = 0;  
+      virtual void set_samp_rate(float samp_rate) = 0;
+      virtual void set_osr(unsigned int osr) = 0; 
     };
    
   } // namespace gsm
diff --git a/include/grgsm/receiver/receiver.h b/include/grgsm/receiver/receiver.h
index 97297ca..e19fe7a 100644
--- a/include/grgsm/receiver/receiver.h
+++ b/include/grgsm/receiver/receiver.h
@@ -26,7 +26,6 @@
 
 #include <grgsm/api.h>
 #include <gnuradio/block.h>
-#include <gnuradio/feval.h>
 #include <gnuradio/sync_block.h>
 #include <vector>
 
diff --git a/installer-packages/.placeholder b/installer-packages/.placeholder
deleted file mode 100644
index e69de29..0000000
--- a/installer-packages/.placeholder
+++ /dev/null
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 3ce05f8..73fef92 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
@@ -53,24 +50,27 @@
     flow_control/burst_fnr_filter_impl.cc
     flow_control/dummy_burst_filter_impl.cc
     misc_utils/controlled_rotator_cc_impl.cc
-    misc_utils/controlled_const_source_f_impl.cc
+    misc_utils/controlled_fractional_resampler_cc_impl.cc
+    misc_utils/msg_to_tag_impl.cc
     misc_utils/message_printer_impl.cc
     misc_utils/tmsi_dumper_impl.cc
     misc_utils/burst_file_sink_impl.cc
     misc_utils/burst_file_source_impl.cc
     misc_utils/message_file_sink_impl.cc
-    misc_utils/message_file_source_impl.cc   
+    misc_utils/message_file_source_impl.cc
+    misc_utils/bursts_printer_impl.cc
+    misc_utils/extract_system_info_impl.cc
+    misc_utils/extract_immediate_assignment_impl.cc
     qa_utils/burst_sink_impl.cc
     qa_utils/burst_source_impl.cc
     qa_utils/message_source_impl.cc
     qa_utils/message_sink_impl.cc
     decryption/decryption_impl.cc
-    msg_to_tag_impl.cc
 )
 
 
 add_library(grgsm SHARED ${grgsm_sources})
-target_link_libraries(grgsm ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${VOLK_LIBRARIES} ${LIBOSMOCORE_LIBRARIES}
+target_link_libraries(grgsm ${Boost_LIBRARIES} ${GNURADIO_ALL_LIBRARIES} ${VOLK_LIBRARIES} ${LIBOSMOCORE_LIBRARIES}
 # libraries required by plotting.h - have troubles to be installed by pybombs
 #    boost_iostreams
 #    boost_system
diff --git a/lib/decoding/tch_f_decoder_impl.cc b/lib/decoding/tch_f_decoder_impl.cc
index f409d37..cc88c90 100644
--- a/lib/decoding/tch_f_decoder_impl.cc
+++ b/lib/decoding/tch_f_decoder_impl.cc
@@ -35,16 +35,16 @@
   namespace gsm {
 
     tch_f_decoder::sptr
-    tch_f_decoder::make(tch_mode mode, const std::string &file, bool boundary_check)
+    tch_f_decoder::make(tch_mode mode, bool boundary_check)
     {
       return gnuradio::get_initial_sptr
-        (new tch_f_decoder_impl(mode, file, boundary_check));
+        (new tch_f_decoder_impl(mode, boundary_check));
     }
 
     /*
      * Constructor
      */
-    tch_f_decoder_impl::tch_f_decoder_impl(tch_mode mode, const std::string &file, bool boundary_check)
+    tch_f_decoder_impl::tch_f_decoder_impl(tch_mode mode, bool boundary_check)
       : gr::block("tch_f_decoder",
               gr::io_signature::make(0, 0, 0),
               gr::io_signature::make(0, 0, 0)),
@@ -52,6 +52,7 @@
       d_collected_bursts_num(0),
       d_boundary_check(boundary_check),
       d_boundary_decode(!boundary_check),
+      d_header_sent(false),
       mBlockCoder(0x10004820009ULL, 40, 224),
       mU(228),
       mP(mU.segment(184,40)),
@@ -65,18 +66,11 @@
       mClass1A_d(mTCHD.head(50)),
       mTCHParity(0x0b, 3, 50)
     {
-        d_speech_file = fopen( file.c_str(), "wb" );
-        if (d_speech_file == NULL)
-        {
-            throw std::runtime_error("TCH/F Decoder: can't open file\n");
-        }
-
-        const unsigned char amr_nb_magic[6] = { 0x23, 0x21, 0x41, 0x4d, 0x52, 0x0a };
-
-        if (d_tch_mode != TCH_FS)
-        {
-            fwrite(amr_nb_magic, 1, 6, d_speech_file);
-        }
+        //setup input/output ports
+        message_port_register_in(pmt::mp("bursts"));
+        set_msg_handler(pmt::mp("bursts"), boost::bind(&tch_f_decoder_impl::decode, this, _1));
+        message_port_register_out(pmt::mp("msgs"));
+        message_port_register_out(pmt::mp("voice"));    
 
         int j, k, B;
         for (k = 0; k < CONV_SIZE; k++)
@@ -86,11 +80,6 @@
             interleave_trans[k] = B * 114 + j;
         }
 
-        //setup input/output ports
-        message_port_register_in(pmt::mp("bursts"));
-        set_msg_handler(pmt::mp("bursts"), boost::bind(&tch_f_decoder_impl::decode, this, _1));
-        message_port_register_out(pmt::mp("msgs"));
-
         setCodingMode(mode);
     }
 
@@ -100,9 +89,20 @@
 
     void tch_f_decoder_impl::decode(pmt::pmt_t msg)
     {
+        if(!d_header_sent)
+        {
+            if (d_tch_mode != TCH_FS)
+            {
+                const unsigned char amr_nb_magic[7] = "#!AMR\n";
+                message_port_pub(pmt::mp("voice"), pmt::cons(pmt::PMT_NIL, pmt::make_blob(amr_nb_magic,6)));
+            }
+            d_header_sent = true;
+        }
+
+
         d_bursts[d_collected_bursts_num] = msg;
         d_collected_bursts_num++;
-
+        
         bool stolen = false;
 
         if (d_collected_bursts_num == 8)
@@ -249,7 +249,7 @@
                 return;
             }
 
-            // Decode voice frames and write to file
+            // Decode voice frames and send to the output
             if (d_tch_mode == TCH_FS || d_tch_mode == TCH_EFR)
             {
                 mVR204Coder.decode(mClass1_c, mTCHU);
@@ -329,7 +329,7 @@
                         amrFrame.pack(frameBuffer);
 
                     }
-                    fwrite(frameBuffer, 1 , mTCHFrameLength, d_speech_file);
+                    message_port_pub(pmt::mp("voice"), pmt::cons(pmt::PMT_NIL, pmt::make_blob(frameBuffer,mTCHFrameLength)));
                 }
             }
             else
@@ -378,7 +378,7 @@
                     // mTCHD.unmap(mAMRBitOrder, payload.size(), payload);
                     mTCHD.copyTo(payload);
                     amrFrame.pack(frameBuffer);
-                    fwrite(frameBuffer, 1 , mAMRFrameLth, d_speech_file);
+                    message_port_pub(pmt::mp("voice"), pmt::cons(pmt::PMT_NIL, pmt::make_blob(frameBuffer,mAMRFrameLth)));
                 }
             }
         }
diff --git a/lib/decoding/tch_f_decoder_impl.h b/lib/decoding/tch_f_decoder_impl.h
index 3e8c79a..0119b5a 100644
--- a/lib/decoding/tch_f_decoder_impl.h
+++ b/lib/decoding/tch_f_decoder_impl.h
@@ -52,10 +52,10 @@
                 unsigned int d_collected_bursts_num;
                 unsigned short interleave_trans[CONV_SIZE];
                 pmt::pmt_t d_bursts[8];
-                FILE * d_speech_file;
                 enum tch_mode d_tch_mode;
                 bool d_boundary_check;
                 bool d_boundary_decode;
+                bool d_header_sent;
 
                 BitVector mU;
                 BitVector mP;
@@ -89,7 +89,7 @@
                 void decode(pmt::pmt_t msg);
                 void setCodingMode(tch_mode mode);
             public:
-                tch_f_decoder_impl(tch_mode mode, const std::string &file, bool boundary_check=true);
+                tch_f_decoder_impl(tch_mode mode, bool boundary_check=false);
                 ~tch_f_decoder_impl();
         };
 
diff --git a/lib/misc_utils/controlled_const_source_f_impl.cc b/lib/misc_utils/controlled_const_source_f_impl.cc
deleted file mode 100644
index ee8d0ae..0000000
--- a/lib/misc_utils/controlled_const_source_f_impl.cc
+++ /dev/null
@@ -1,86 +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 "controlled_const_source_f_impl.h"
-
-namespace gr {
-  namespace gsm {
-
-    controlled_const_source_f::sptr
-    controlled_const_source_f::make(float constant)
-    {
-      return gnuradio::get_initial_sptr
-        (new controlled_const_source_f_impl(constant));
-    }
-    
-    void controlled_const_source_f_impl::set_constant_msg(pmt::pmt_t msg){
-      if(pmt::is_real(msg)){
-          set_constant(pmt::to_double(msg));
-      }
-    }
-
-    /*
-     * The private constructor
-     */
-    controlled_const_source_f_impl::controlled_const_source_f_impl(float constant)
-      : gr::sync_block("controlled_const_source_f",
-              gr::io_signature::make(0, 0, 0),
-              gr::io_signature::make(1, 1, sizeof(float)))
-    {
-        set_constant(constant);
-        message_port_register_in(pmt::mp("constant_msg"));
-        set_msg_handler(pmt::mp("constant_msg"), boost::bind(&controlled_const_source_f_impl::set_constant_msg, this, _1));
-    }
-
-    /*
-     * Our virtual destructor.
-     */
-    controlled_const_source_f_impl::~controlled_const_source_f_impl()
-    {
-    }
-
-    int
-    controlled_const_source_f_impl::work(int noutput_items,
-			  gr_vector_const_void_star &input_items,
-			  gr_vector_void_star &output_items)
-    {
-      float *optr = (float*)output_items[0];
-      float t;
-      
-      t = d_constant;
-      std::fill_n(optr, noutput_items, t);
-
-      return noutput_items;
-    }
-    
-    void controlled_const_source_f_impl::set_constant(float constant){
-      d_constant = constant;
-    }
-
-  } /* namespace gsm */
-} /* namespace gr */
-
diff --git a/lib/misc_utils/controlled_const_source_f_impl.h b/lib/misc_utils/controlled_const_source_f_impl.h
deleted file mode 100644
index 36a6258..0000000
--- a/lib/misc_utils/controlled_const_source_f_impl.h
+++ /dev/null
@@ -1,53 +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.
- */
-
-#ifndef INCLUDED_GSM_CONTROLLED_CONST_SOURCE_F_IMPL_H
-#define INCLUDED_GSM_CONTROLLED_CONST_SOURCE_F_IMPL_H
-
-#include <grgsm/misc_utils/controlled_const_source_f.h>
-
-namespace gr {
-  namespace gsm {
-
-    class controlled_const_source_f_impl : public controlled_const_source_f
-    {
-     private:
-      float d_constant;
-      void set_constant_msg(pmt::pmt_t msg);
-      
-     public:
-      controlled_const_source_f_impl(float constant);
-      ~controlled_const_source_f_impl();
-
-      // Where all the action really happens
-      int work(int noutput_items,
-	       gr_vector_const_void_star &input_items,
-	       gr_vector_void_star &output_items);
-	       
-	  virtual void set_constant(float constant);
-    };
-
-  } // namespace gsm
-} // namespace gr
-
-#endif /* INCLUDED_GSM_CONTROLLED_CONST_SOURCE_F_IMPL_H */
-
diff --git a/lib/misc_utils/controlled_fractional_resampler_cc_impl.cc b/lib/misc_utils/controlled_fractional_resampler_cc_impl.cc
new file mode 100644
index 0000000..cf15a04
--- /dev/null
+++ b/lib/misc_utils/controlled_fractional_resampler_cc_impl.cc
@@ -0,0 +1,182 @@
+/* -*- c++ -*- */
+/* @file
+ * @author Piotr Krysik <ptrkrysik@gmail.com>
+ * @section LICENSE
+ * 
+ * Gr-gsm is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * Gr-gsm is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with gr-gsm; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ * 
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gnuradio/io_signature.h>
+#include "controlled_fractional_resampler_cc_impl.h"
+#include <stdexcept>
+
+namespace gr {
+  namespace gsm {
+
+    controlled_fractional_resampler_cc::sptr
+    controlled_fractional_resampler_cc::make(float phase_shift, float resamp_ratio)
+    {
+      return gnuradio::get_initial_sptr
+        (new controlled_fractional_resampler_cc_impl(phase_shift, resamp_ratio));
+    }
+
+    controlled_fractional_resampler_cc_impl::controlled_fractional_resampler_cc_impl
+                                     (float phase_shift, float resamp_ratio)
+      : block("controlled_fractional_resampler_cc",
+              io_signature::make(1, 1, sizeof(gr_complex)),
+              io_signature::make(1, 1, sizeof(gr_complex))),
+        d_mu(phase_shift), d_mu_inc(resamp_ratio),
+        d_resamp(new mmse_fir_interpolator_cc())
+    {
+      this->set_tag_propagation_policy(TPP_DONT);
+      if(resamp_ratio <=  0)
+        throw std::out_of_range("resampling ratio must be > 0");
+      if(phase_shift <  0  || phase_shift > 1)
+        throw std::out_of_range("phase shift ratio must be > 0 and < 1");
+
+      set_relative_rate(1.0 / resamp_ratio);
+    }
+
+    controlled_fractional_resampler_cc_impl::~controlled_fractional_resampler_cc_impl()
+    {
+      delete d_resamp;
+    }
+
+    void
+    controlled_fractional_resampler_cc_impl::forecast(int noutput_items,
+                                           gr_vector_int &ninput_items_required)
+    {
+      unsigned ninputs = ninput_items_required.size();
+      for(unsigned i=0; i < ninputs; i++) {
+        ninput_items_required[i] =
+          (int)ceil((noutput_items * d_mu_inc) + d_resamp->ntaps());
+      }
+    }
+
+    int
+    controlled_fractional_resampler_cc_impl::general_work(int noutput_items,
+                                               gr_vector_int &ninput_items,
+                                               gr_vector_const_void_star &input_items,
+                                               gr_vector_void_star &output_items)
+    {
+      const gr_complex *in = (const gr_complex*)input_items[0];
+      gr_complex *out = (gr_complex*)output_items[0];
+      
+      uint64_t processed_in = 0; //input samples processed in the last call to resample function
+      uint64_t processed_in_sum = 0; //input samples processed during a whole call to general_work function
+      uint64_t produced_out_sum = 0; //output samples produced during a whole call to general_work function
+
+      std::vector<tag_t> set_resamp_ratio_tags;
+
+      pmt::pmt_t key = pmt::string_to_symbol("set_resamp_ratio");
+      get_tags_in_window(set_resamp_ratio_tags, 0, 0, ninput_items[0]);
+      
+      bool all_output_samples_produced = false;
+      for(std::vector<tag_t>::iterator i_tag = set_resamp_ratio_tags.begin(); i_tag < set_resamp_ratio_tags.end(); i_tag++)
+      {
+        uint64_t tag_offset_rel = i_tag->offset - nitems_read(0);
+        
+        if(pmt::symbol_to_string(i_tag->key) == "set_resamp_ratio")
+        {
+          uint64_t samples_to_produce = static_cast<uint64_t>(round(static_cast<double>(tag_offset_rel-processed_in_sum)/d_mu_inc)); //tu może być problem - bo to jest gÅ‚upota przy d_mu_inc różnym od 1.0
+          
+          if( (samples_to_produce + produced_out_sum) > noutput_items)
+          {
+            samples_to_produce = noutput_items - produced_out_sum;
+            all_output_samples_produced = true;
+          }
+          
+          processed_in = resample(in, processed_in_sum, out, produced_out_sum, samples_to_produce);
+          processed_in_sum = processed_in_sum + processed_in;
+          produced_out_sum = produced_out_sum + samples_to_produce;
+
+          if(all_output_samples_produced)
+          {
+            break;
+          } else {
+              add_item_tag(0, produced_out_sum + nitems_written(0), i_tag->key, i_tag->value);                       
+              set_resamp_ratio(pmt::to_double(i_tag->value));
+          }
+        } else {
+          uint64_t out_samples_to_tag = round(static_cast<double>(tag_offset_rel-processed_in_sum)/d_mu_inc);
+          if( (out_samples_to_tag + produced_out_sum) <= noutput_items)
+          {
+            add_item_tag(0, produced_out_sum + out_samples_to_tag + nitems_written(0), i_tag->key, i_tag->value);
+          }
+        }
+      }
+
+      if(!all_output_samples_produced)
+      {
+        processed_in = resample(in, processed_in_sum, out, produced_out_sum, (noutput_items-produced_out_sum));
+        processed_in_sum = processed_in_sum + processed_in;
+      }
+      
+      consume_each(processed_in_sum);
+      return noutput_items;
+    }
+    
+    inline uint64_t 
+    controlled_fractional_resampler_cc_impl::resample(const gr_complex *in, uint64_t first_in_sample, gr_complex *out, uint64_t first_out_sample, uint64_t samples_to_produce)
+    {
+      int ii = first_in_sample;
+      int oo = first_out_sample;
+      while(oo < (first_out_sample+samples_to_produce)) //produce samples_to_produce number of samples
+      {
+        out[oo++] = d_resamp->interpolate(&in[ii], d_mu);
+      
+        double s = d_mu + d_mu_inc;
+        double f = floor(s);
+        int incr = (int)f;
+        d_mu = s - f;
+        ii += incr;
+      }
+      return ii-first_in_sample; //number of input samples processed
+    }
+
+    float
+    controlled_fractional_resampler_cc_impl::mu() const
+    {
+      return d_mu;
+    }
+
+    float
+    controlled_fractional_resampler_cc_impl::resamp_ratio() const
+    {
+      return d_mu_inc;
+    }
+
+    void
+    controlled_fractional_resampler_cc_impl::set_mu(float mu)
+    {
+      d_mu = mu;
+    }
+
+    void
+    controlled_fractional_resampler_cc_impl::set_resamp_ratio(float resamp_ratio)
+    {
+      d_mu_inc = resamp_ratio;
+      set_relative_rate(1.0 / resamp_ratio);
+    }
+
+  } /* namespace grgsm */
+} /* namespace gr */
+
diff --git a/lib/misc_utils/controlled_fractional_resampler_cc_impl.h b/lib/misc_utils/controlled_fractional_resampler_cc_impl.h
new file mode 100644
index 0000000..de32c34
--- /dev/null
+++ b/lib/misc_utils/controlled_fractional_resampler_cc_impl.h
@@ -0,0 +1,71 @@
+/* -*- 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/misc_utils/controlled_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..a91fd08 100644
--- a/lib/misc_utils/controlled_rotator_cc_impl.cc
+++ b/lib/misc_utils/controlled_rotator_cc_impl.cc
@@ -32,22 +32,21 @@
   namespace gsm {
 
     controlled_rotator_cc::sptr
-    controlled_rotator_cc::make(double phase_inc, double samp_rate)
+    controlled_rotator_cc::make(double phase_inc)
     {
       return gnuradio::get_initial_sptr
-        (new controlled_rotator_cc_impl(phase_inc, samp_rate));
+        (new controlled_rotator_cc_impl(phase_inc));
     }
 
     /*
      * The private constructor
      */
-    controlled_rotator_cc_impl::controlled_rotator_cc_impl(double phase_inc, double samp_rate)
+    controlled_rotator_cc_impl::controlled_rotator_cc_impl(double phase_inc)
       : gr::sync_block("controlled_rotator_cc",
               gr::io_signature::make2(1, 2, sizeof(gr_complex), sizeof(float)),
               gr::io_signature::make(1, 1, sizeof(gr_complex)))
     {
       set_phase_inc(phase_inc);
-      set_samp_rate(samp_rate);
     }
     
     /*
@@ -64,21 +63,19 @@
       d_r.set_phase_incr( exp(gr_complex(0, (double)phase_inc)) );
     }
 
-    void
-    controlled_rotator_cc_impl::set_samp_rate(double samp_rate)
-    {
-      d_samp_rate = samp_rate;
-    }
+//    void
+//    controlled_rotator_cc_impl::set_samp_rate(double samp_rate)
+//    {
+//      d_samp_rate = samp_rate;
+//    }
 
     int
     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];
-
-      if(input_items.size() == 2) {
+		{
+		  //process phase_inc input
+      /*if(input_items.size() == 2) {
         int ii=0;
         const float *pp = (const float *)input_items[1];
         
@@ -101,10 +98,39 @@
           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..fb29356 100644
--- a/lib/misc_utils/controlled_rotator_cc_impl.h
+++ b/lib/misc_utils/controlled_rotator_cc_impl.h
@@ -33,15 +33,16 @@
     {
      private:
       gr_complex d_phase_inc;
-      double d_samp_rate;
+//      double d_samp_rate;
       blocks::rotator d_r;
 
      public:
-      controlled_rotator_cc_impl(double phase_inc, double samp_rate);
+      controlled_rotator_cc_impl(double phase_inc);
       ~controlled_rotator_cc_impl();
 
       virtual void set_phase_inc(double phase_inc);
-      virtual void set_samp_rate(double samp_rate);
+//      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 89%
rename from lib/msg_to_tag_impl.h
rename to lib/misc_utils/msg_to_tag_impl.h
index e761d3e..4af794c 100644
--- a/lib/msg_to_tag_impl.h
+++ b/lib/misc_utils/msg_to_tag_impl.h
@@ -23,19 +23,20 @@
 #ifndef INCLUDED_GRGSM_MSG_TO_TAG_IMPL_H
 #define INCLUDED_GRGSM_MSG_TO_TAG_IMPL_H
 
-#include <grgsm/msg_to_tag.h>
+#include <grgsm/misc_utils/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..7fef8fa 100644
--- a/lib/receiver/clock_offset_control_impl.cc
+++ b/lib/receiver/clock_offset_control_impl.cc
@@ -26,6 +26,7 @@
 #endif
 
 #include <sch.h>
+#include <gsm_constants.h>
 #include "clock_offset_control_impl.h"
 
 namespace gr
@@ -33,17 +34,17 @@
 namespace gsm
 {
 clock_offset_control::sptr
-clock_offset_control::make(float fc)
+clock_offset_control::make(float fc, float samp_rate, unsigned int osr)
 {
     return gnuradio::get_initial_sptr
-           (new clock_offset_control_impl(fc));
+           (new clock_offset_control_impl(fc, samp_rate, osr));
 }
 
 
 /*
  * 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, unsigned int osr)
     : gr::block("clock_offset_control",
                 gr::io_signature::make(0, 0, 0),
                 gr::io_signature::make(0, 0, 0))
@@ -51,9 +52,11 @@
 {
     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);
+    set_osr(osr);
     d_alfa = 0.3;
     d_ppm_estimate = -1e6;
     d_last_ppm_estimate = -1e6;    
@@ -72,11 +75,21 @@
 {
 }
 
+void clock_offset_control_impl::set_osr(unsigned int osr)
+{
+    d_osr = osr;
+}
+
 void clock_offset_control_impl::set_fc(float fc)
 {
     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 +116,74 @@
             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(freq_offset);
+                    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(freq_offset);
+                            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 freq_offset)
+{
+    double samp_rate_ratio = d_samp_rate / (d_osr * GSM_SYMBOL_RATE);
+
+    pmt::pmt_t messages = pmt::make_dict();
+    messages = dict_add(messages, pmt::string_to_symbol("set_phase_inc"), pmt::from_double(-2*M_PI*freq_offset/(d_osr * GSM_SYMBOL_RATE)));
+    messages = dict_add(messages, pmt::string_to_symbol("set_resamp_ratio"), pmt::from_double((1-(freq_offset/d_fc))*samp_rate_ratio));
+    messages = dict_add(messages, pmt::string_to_symbol("setting_freq_offset"), pmt::from_double(-freq_offset));
+    message_port_pub(pmt::intern("ctrl"), messages);
+}
+
 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..60c3df6 100644
--- a/lib/receiver/clock_offset_control_impl.h
+++ b/lib/receiver/clock_offset_control_impl.h
@@ -32,9 +32,11 @@
     {
      private:
         float d_fc;
+        float d_samp_rate;
+        unsigned int d_osr;
         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 +45,16 @@
         bool  d_first_time;
                         
         void process_measurement(pmt::pmt_t msg);
+        void send_ctrl_messages(float freq_offset);
         void timed_reset();
         void reset();
      public:
-       clock_offset_control_impl(float fc);
+       clock_offset_control_impl(float fc, float samp_rate, unsigned int osr);
       ~clock_offset_control_impl();
 
       virtual void set_fc(float fc);
+      virtual void set_samp_rate(float samp_rate);
+      virtual void set_osr(unsigned int osr);
     };
   } // namespace gsm
 } // namespace gr
diff --git a/lib/receiver/cx_channel_hopper_impl.cc b/lib/receiver/cx_channel_hopper_impl.cc
index 2818278..27a0cae 100644
--- a/lib/receiver/cx_channel_hopper_impl.cc
+++ b/lib/receiver/cx_channel_hopper_impl.cc
@@ -141,20 +141,10 @@
     {
         pmt::pmt_t header_plus_burst = pmt::cdr(msg);
         gsmtap_hdr *header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst);
-        bool uplink_burst = (be16toh(header->arfcn) & 0x4000) ? true : false;
 
         uint32_t frame_nr = be32toh(header->frame_number);
-        uint16_t frame_ca;
-
-        // FIXED for uplink
-        if (uplink_burst)
-        {
-            frame_ca = be16toh(header->arfcn)-16384;    //16384 = 0x4000
-        }
-        else
-        {
-            frame_ca = be16toh(header->arfcn);
-        }
+        uint16_t frame_ca = be16toh(header->arfcn) & 0x3FFF;    //change highest bits to '0'
+                                                                //in order to leave only ARFCN number
 
         int mai = calculate_ma_sfh(d_maio, d_hsn, d_narfcn, frame_nr);
 
diff --git a/lib/receiver/receiver_impl.cc b/lib/receiver/receiver_impl.cc
index 09a3703..b1afc92 100644
--- a/lib/receiver/receiver_impl.cc
+++ b/lib/receiver/receiver_impl.cc
@@ -124,11 +124,10 @@
     pmt::pmt_t key = pmt::string_to_symbol("setting_freq_offset");
     get_tags_in_range(freq_offset_tags, 0, start, stop, key);
     bool freq_offset_tag_in_fcch = false;
-    uint64_t tag_offset=-1; //-1 - just some clearly invalid value
     
     if(!freq_offset_tags.empty()){
         tag_t freq_offset_tag = freq_offset_tags[0];
-        tag_offset = freq_offset_tag.offset - start;
+        uint64_t tag_offset = freq_offset_tag.offset - start;
         
         burst_type b_type = d_channel_conf.get_burst_type(d_burst_nr);
         if(d_state == synchronized && b_type == fcch_burst){
@@ -136,10 +135,8 @@
             if(tag_offset < last_sample_nr){
                 freq_offset_tag_in_fcch = true;
             }
-            d_freq_offset_setting = pmt::to_double(freq_offset_tag.value);
-        } else {
-            d_freq_offset_setting = pmt::to_double(freq_offset_tag.value);
         }
+        d_freq_offset_setting = pmt::to_double(freq_offset_tag.value);
     }
     
     switch (d_state)
@@ -235,14 +232,17 @@
             {
             case fcch_burst:                                                                      //if it's FCCH  burst
             {
-                const unsigned first_sample = ceil((GUARD_PERIOD + 2 * TAIL_BITS) * d_OSR) + 1;
-                const unsigned last_sample = first_sample + USEFUL_BITS * d_OSR - TAIL_BITS * d_OSR;
-                double freq_offset_tmp = compute_freq_offset(input, first_sample, last_sample);       //extract frequency offset from it
+                if(freq_offset_tag_in_fcch==false)
+                {
+                    const unsigned first_sample = ceil((GUARD_PERIOD + 2 * TAIL_BITS) * d_OSR) + 1;
+                    const unsigned last_sample = first_sample + USEFUL_BITS * d_OSR - TAIL_BITS * d_OSR;
+                    double freq_offset_tmp = compute_freq_offset(input, first_sample, last_sample);       //extract frequency offset from it
 
-                send_burst(d_burst_nr, fc_fb, GSMTAP_BURST_FCCH, input_nr);
+                    send_burst(d_burst_nr, fc_fb, GSMTAP_BURST_FCCH, input_nr);
 
-                pmt::pmt_t msg = pmt::make_tuple(pmt::mp("freq_offset"),pmt::from_double(freq_offset_tmp-d_freq_offset_setting),pmt::mp("synchronized"));
-                message_port_pub(pmt::mp("measurements"), msg);
+                    pmt::pmt_t msg = pmt::make_tuple(pmt::mp("freq_offset"),pmt::from_double(freq_offset_tmp-d_freq_offset_setting),pmt::mp("synchronized"));
+                    message_port_pub(pmt::mp("measurements"), msg);
+                }
                 break;
             }
             case sch_burst:                                                                      //if it's SCH burst
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index aa77ff1..89157ed 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -41,7 +41,7 @@
     receiver/fcch_detector.py
     receiver/chirpz.py
     misc_utils/arfcn.py
-    misc_utils/clock_offset_corrector.py 
+    misc_utils/clock_offset_corrector_tagged.py
     misc_utils/hier_block.py DESTINATION ${GR_PYTHON_DIR}/grgsm
 )
 
@@ -61,5 +61,6 @@
 GR_ADD_TEST(qa_burst_sdcch_subslot_filter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_sdcch_subslot_filter.py)
 GR_ADD_TEST(qa_burst_fnr_filter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_fnr_filter.py)
 GR_ADD_TEST(qa_dummy_burst_filter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_dummy_burst_filter.py)
-GR_ADD_TEST(qa_arfcn ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_arfcn.py)
-GR_ADD_TEST(qa_msg_to_tag ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_msg_to_tag.py)
+#GR_ADD_TEST(qa_arfcn ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_arfcn.py)
+#GR_ADD_TEST(qa_msg_to_tag ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_msg_to_tag.py)
+#GR_ADD_TEST(qa_controlled_fractional_resampler_cc ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_controlled_fractional_resampler_cc.py)
diff --git a/python/__init__.py b/python/__init__.py
index dfa7a0e..76c6b99 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -50,7 +50,7 @@
 from fcch_burst_tagger import fcch_burst_tagger
 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.py b/python/misc_utils/clock_offset_corrector.py
deleted file mode 100644
index ce222a0..0000000
--- a/python/misc_utils/clock_offset_corrector.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/usr/bin/env python
-##################################################
-# Gnuradio Python Flow Graph
-# Title: Clock offset corrector
-# Author: Piotr Krysik
-# Generated: Wed Nov 19 08:38:40 2014
-##################################################
-
-from gnuradio import blocks
-from gnuradio import gr
-from gnuradio.filter import firdes
-import grgsm
-import math
-
-class clock_offset_corrector(grgsm.hier_block):
-
-    def __init__(self, fc=936.6e6, ppm=0, samp_rate_in=1625000.0/6.0*4.0):
-        grgsm.hier_block.__init__(
-            self, "Clock offset corrector",
-            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("ppm_in")
-        
-        ##################################################
-        # 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(0,samp_rate_out)
-        self.gsm_controlled_const_source_f_0 = grgsm.controlled_const_source_f(ppm)
-        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((fc/samp_rate_out*(2*math.pi)/1e6, ))
-
-        ##################################################
-        # Connections
-        ##################################################
-        self.msg_connect((self, 'ppm_in'), (self.gsm_controlled_const_source_f_0, 'constant_msg'))    
-        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.gsm_controlled_rotator_cc_0, 1))    
-        self.connect((self.gsm_controlled_const_source_f_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
-        self.connect((self.gsm_controlled_rotator_cc_0, 0), (self, 0))    
-        self.connect((self, 0), (self.gsm_controlled_rotator_cc_0, 0))    
-
-    def get_fc(self):
-        return self.fc
-
-    def set_fc(self, fc):
-        self.fc = fc
-        self.blocks_multiply_const_vxx_0.set_k((self.fc/self.samp_rate_out*(2*math.pi)/1e6, ))
-
-    def get_ppm(self):
-        return self.ppm
-
-    def set_ppm(self, ppm):
-        self.ppm = ppm
-        self.gsm_controlled_const_source_f_0.set_constant(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.set_samp_rate_out(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)
-        self.blocks_multiply_const_vxx_0.set_k((self.fc/self.samp_rate_out*(2*math.pi)/1e6, ))
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..bf4b455
--- /dev/null
+++ b/python/misc_utils/clock_offset_corrector_tagged.py
@@ -0,0 +1,98 @@
+# -*- coding: utf-8 -*-
+##################################################
+# GNU Radio Python Flow Graph
+# Title: Clock Offset Corrector Tagged
+# Author: Piotr Krysik
+# Description: Clock offset corrector with blocks that use tags to switch offsets
+# Generated: Wed Jul 20 20:07:11 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, osr=4, 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.osr = osr
+        self.ppm = ppm
+        self.samp_rate_in = samp_rate_in
+
+        ##################################################
+        # Variables
+        ##################################################
+        self.gsm_symb_rate = gsm_symb_rate = 1625000.0/6.0
+        self.samp_rate_out = samp_rate_out = osr*gsm_symb_rate
+
+        ##################################################
+        # Blocks
+        ##################################################
+        self.gsm_msg_to_tag_0 = grgsm.msg_to_tag()
+        self.gsm_controlled_rotator_cc_0 = grgsm.controlled_rotator_cc(ppm/1.0e6*2*math.pi*fc/samp_rate_out)
+        self.gsm_controlled_fractional_resampler_cc_0 = grgsm.controlled_fractional_resampler_cc(0, (1-ppm/1.0e6)*(samp_rate_in/samp_rate_out))
+
+        ##################################################
+        # Connections
+        ##################################################
+        self.msg_connect((self, 'ctrl'), (self.gsm_msg_to_tag_0, 'msg'))    
+        self.connect((self.gsm_controlled_fractional_resampler_cc_0, 0), (self.gsm_controlled_rotator_cc_0, 0))    
+        self.connect((self.gsm_controlled_rotator_cc_0, 0), (self, 0))    
+        self.connect((self.gsm_msg_to_tag_0, 0), (self.gsm_controlled_fractional_resampler_cc_0, 0))    
+        self.connect((self, 0), (self.gsm_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_out)
+
+    def get_osr(self):
+        return self.osr
+
+    def set_osr(self, osr):
+        self.osr = osr
+        self.set_samp_rate_out(self.osr*self.gsm_symb_rate)
+
+    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_out)
+        self.gsm_controlled_fractional_resampler_cc_0.set_resamp_ratio((1-self.ppm/1.0e6)*(self.samp_rate_in/self.samp_rate_out))
+
+    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_controlled_fractional_resampler_cc_0.set_resamp_ratio((1-self.ppm/1.0e6)*(self.samp_rate_in/self.samp_rate_out))
+
+    def get_gsm_symb_rate(self):
+        return self.gsm_symb_rate
+
+    def set_gsm_symb_rate(self, gsm_symb_rate):
+        self.gsm_symb_rate = gsm_symb_rate
+        self.set_samp_rate_out(self.osr*self.gsm_symb_rate)
+
+    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_phase_inc(self.ppm/1.0e6*2*math.pi*self.fc/self.samp_rate_out)
+        self.gsm_controlled_fractional_resampler_cc_0.set_resamp_ratio((1-self.ppm/1.0e6)*(self.samp_rate_in/self.samp_rate_out))
diff --git a/python/qa_arfcn.py b/python/qa_arfcn.py
index 85be110..3e8a5ee 100755
--- a/python/qa_arfcn.py
+++ b/python/qa_arfcn.py
@@ -22,7 +22,8 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
+import arfcn
 import os
 import sys
 
@@ -30,257 +31,257 @@
 class qa_arfcn (gr_unittest.TestCase):
    
     def test_001_is_valid_arfcn(self):
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(259, 'GSM450'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(277, 'GSM450'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(293, 'GSM450'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(258, 'GSM450'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(294, 'GSM450'))
+        self.assertTrue(arfcn.is_valid_arfcn(259, 'GSM450'))
+        self.assertTrue(arfcn.is_valid_arfcn(277, 'GSM450'))
+        self.assertTrue(arfcn.is_valid_arfcn(293, 'GSM450'))
+        self.assertFalse(arfcn.is_valid_arfcn(258, 'GSM450'))
+        self.assertFalse(arfcn.is_valid_arfcn(294, 'GSM450'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(306, 'GSM480'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(323, 'GSM480'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(340, 'GSM480'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(305, 'GSM480'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(341, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_arfcn(306, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_arfcn(323, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_arfcn(340, 'GSM480'))
+        self.assertFalse(arfcn.is_valid_arfcn(305, 'GSM480'))
+        self.assertFalse(arfcn.is_valid_arfcn(341, 'GSM480'))
                 
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(128, 'GSM850'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(199, 'GSM850'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(251, 'GSM850'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(127, 'GSM480'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(251, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_arfcn(128, 'GSM850'))
+        self.assertTrue(arfcn.is_valid_arfcn(199, 'GSM850'))
+        self.assertTrue(arfcn.is_valid_arfcn(251, 'GSM850'))
+        self.assertFalse(arfcn.is_valid_arfcn(127, 'GSM480'))
+        self.assertFalse(arfcn.is_valid_arfcn(251, 'GSM480'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(1, 'P-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(63, 'P-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(124, 'P-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(0, 'P-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(125, 'P-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(1, 'P-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(63, 'P-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(124, 'P-GSM'))
+        self.assertFalse(arfcn.is_valid_arfcn(0, 'P-GSM'))
+        self.assertFalse(arfcn.is_valid_arfcn(125, 'P-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(975, 'E-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(999, 'E-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(1023, 'E-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(974, 'E-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(1024, 'E-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(975, 'E-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(999, 'E-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(1023, 'E-GSM'))
+        self.assertFalse(arfcn.is_valid_arfcn(974, 'E-GSM'))
+        self.assertFalse(arfcn.is_valid_arfcn(1024, 'E-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(955, 'R-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(989, 'R-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(1023, 'R-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(954, 'R-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(1024, 'R-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(955, 'R-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(989, 'R-GSM'))
+        self.assertTrue(arfcn.is_valid_arfcn(1023, 'R-GSM'))
+        self.assertFalse(arfcn.is_valid_arfcn(954, 'R-GSM'))
+        self.assertFalse(arfcn.is_valid_arfcn(1024, 'R-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(512, 'DCS1800'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(732, 'DCS1800'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(885, 'DCS1800'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(511, 'DCS1800'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(886, 'DCS1800'))
+        self.assertTrue(arfcn.is_valid_arfcn(512, 'DCS1800'))
+        self.assertTrue(arfcn.is_valid_arfcn(732, 'DCS1800'))
+        self.assertTrue(arfcn.is_valid_arfcn(885, 'DCS1800'))
+        self.assertFalse(arfcn.is_valid_arfcn(511, 'DCS1800'))
+        self.assertFalse(arfcn.is_valid_arfcn(886, 'DCS1800'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(512, 'PCS1900'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(691, 'PCS1900'))
-        self.assertTrue(grgsm.arfcn.is_valid_arfcn(810, 'PCS1900'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(511, 'PCS1900'))
-        self.assertFalse(grgsm.arfcn.is_valid_arfcn(811, 'PCS1900'))
+        self.assertTrue(arfcn.is_valid_arfcn(512, 'PCS1900'))
+        self.assertTrue(arfcn.is_valid_arfcn(691, 'PCS1900'))
+        self.assertTrue(arfcn.is_valid_arfcn(810, 'PCS1900'))
+        self.assertFalse(arfcn.is_valid_arfcn(511, 'PCS1900'))
+        self.assertFalse(arfcn.is_valid_arfcn(811, 'PCS1900'))
 
 
     def test_002_is_valid_uplink(self):
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(450.6e6, 'GSM450'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(457.4e6, 'GSM450'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(450.4e6, 'GSM450'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(457.6e6, 'GSM450'))
+        self.assertTrue(arfcn.is_valid_uplink(450.6e6, 'GSM450'))
+        self.assertTrue(arfcn.is_valid_uplink(457.4e6, 'GSM450'))
+        self.assertFalse(arfcn.is_valid_uplink(450.4e6, 'GSM450'))
+        self.assertFalse(arfcn.is_valid_uplink(457.6e6, 'GSM450'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(479e6, 'GSM480'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(485.8e6, 'GSM480'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(478.8e6, 'GSM480'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(486e6, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_uplink(479e6, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_uplink(485.8e6, 'GSM480'))
+        self.assertFalse(arfcn.is_valid_uplink(478.8e6, 'GSM480'))
+        self.assertFalse(arfcn.is_valid_uplink(486e6, 'GSM480'))
                 
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(824.2e6, 'GSM850'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(848.8e6, 'GSM850'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(824e6, 'GSM850'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(849e6, 'GSM850'))
+        self.assertTrue(arfcn.is_valid_uplink(824.2e6, 'GSM850'))
+        self.assertTrue(arfcn.is_valid_uplink(848.8e6, 'GSM850'))
+        self.assertFalse(arfcn.is_valid_uplink(824e6, 'GSM850'))
+        self.assertFalse(arfcn.is_valid_uplink(849e6, 'GSM850'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(890.2e6, 'P-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(914.8e6, 'P-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(890e6, 'P-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(915e6, 'P-GSM'))
+        self.assertTrue(arfcn.is_valid_uplink(890.2e6, 'P-GSM'))
+        self.assertTrue(arfcn.is_valid_uplink(914.8e6, 'P-GSM'))
+        self.assertFalse(arfcn.is_valid_uplink(890e6, 'P-GSM'))
+        self.assertFalse(arfcn.is_valid_uplink(915e6, 'P-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(880.2e6, 'E-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(889.8e6, 'E-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(880e6, 'E-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(890e6, 'E-GSM'))
+        self.assertTrue(arfcn.is_valid_uplink(880.2e6, 'E-GSM'))
+        self.assertTrue(arfcn.is_valid_uplink(889.8e6, 'E-GSM'))
+        self.assertFalse(arfcn.is_valid_uplink(880e6, 'E-GSM'))
+        self.assertFalse(arfcn.is_valid_uplink(890e6, 'E-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(876.2e6, 'R-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(889.8e6, 'R-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(876e6, 'R-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(890e6, 'R-GSM'))
+        self.assertTrue(arfcn.is_valid_uplink(876.2e6, 'R-GSM'))
+        self.assertTrue(arfcn.is_valid_uplink(889.8e6, 'R-GSM'))
+        self.assertFalse(arfcn.is_valid_uplink(876e6, 'R-GSM'))
+        self.assertFalse(arfcn.is_valid_uplink(890e6, 'R-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(1710.2e6, 'DCS1800'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(1784.8e6, 'DCS1800'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(1710e6, 'DCS1800'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(1785e6, 'DCS1800'))
+        self.assertTrue(arfcn.is_valid_uplink(1710.2e6, 'DCS1800'))
+        self.assertTrue(arfcn.is_valid_uplink(1784.8e6, 'DCS1800'))
+        self.assertFalse(arfcn.is_valid_uplink(1710e6, 'DCS1800'))
+        self.assertFalse(arfcn.is_valid_uplink(1785e6, 'DCS1800'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(1850.2e6, 'PCS1900'))
-        self.assertTrue(grgsm.arfcn.is_valid_uplink(1909.8e6, 'PCS1900'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(1850e6, 'PCS1900'))
-        self.assertFalse(grgsm.arfcn.is_valid_uplink(1910e6, 'PCS1900'))
+        self.assertTrue(arfcn.is_valid_uplink(1850.2e6, 'PCS1900'))
+        self.assertTrue(arfcn.is_valid_uplink(1909.8e6, 'PCS1900'))
+        self.assertFalse(arfcn.is_valid_uplink(1850e6, 'PCS1900'))
+        self.assertFalse(arfcn.is_valid_uplink(1910e6, 'PCS1900'))
 
 
     def test_003_is_valid_downlink(self):
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(460.6e6, 'GSM450'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(467.4e6, 'GSM450'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(460.4e6, 'GSM450'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(467.6e6, 'GSM450'))
+        self.assertTrue(arfcn.is_valid_downlink(460.6e6, 'GSM450'))
+        self.assertTrue(arfcn.is_valid_downlink(467.4e6, 'GSM450'))
+        self.assertFalse(arfcn.is_valid_downlink(460.4e6, 'GSM450'))
+        self.assertFalse(arfcn.is_valid_downlink(467.6e6, 'GSM450'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(489e6, 'GSM480'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(495.8e6, 'GSM480'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(488.8e6, 'GSM480'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(496e6, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_downlink(489e6, 'GSM480'))
+        self.assertTrue(arfcn.is_valid_downlink(495.8e6, 'GSM480'))
+        self.assertFalse(arfcn.is_valid_downlink(488.8e6, 'GSM480'))
+        self.assertFalse(arfcn.is_valid_downlink(496e6, 'GSM480'))
                 
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(869.2e6, 'GSM850'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(893.8e6, 'GSM850'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(869e6, 'GSM850'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(894e6, 'GSM850'))
+        self.assertTrue(arfcn.is_valid_downlink(869.2e6, 'GSM850'))
+        self.assertTrue(arfcn.is_valid_downlink(893.8e6, 'GSM850'))
+        self.assertFalse(arfcn.is_valid_downlink(869e6, 'GSM850'))
+        self.assertFalse(arfcn.is_valid_downlink(894e6, 'GSM850'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(935.2e6, 'P-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(959.8e6, 'P-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(935e6, 'P-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(960e6, 'P-GSM'))
+        self.assertTrue(arfcn.is_valid_downlink(935.2e6, 'P-GSM'))
+        self.assertTrue(arfcn.is_valid_downlink(959.8e6, 'P-GSM'))
+        self.assertFalse(arfcn.is_valid_downlink(935e6, 'P-GSM'))
+        self.assertFalse(arfcn.is_valid_downlink(960e6, 'P-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(925.2e6, 'E-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(934.8e6, 'E-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(925e6, 'E-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(935e6, 'E-GSM'))
+        self.assertTrue(arfcn.is_valid_downlink(925.2e6, 'E-GSM'))
+        self.assertTrue(arfcn.is_valid_downlink(934.8e6, 'E-GSM'))
+        self.assertFalse(arfcn.is_valid_downlink(925e6, 'E-GSM'))
+        self.assertFalse(arfcn.is_valid_downlink(935e6, 'E-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(921.2e6, 'R-GSM'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(934.8e6, 'R-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(921e6, 'R-GSM'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(935e6, 'R-GSM'))
+        self.assertTrue(arfcn.is_valid_downlink(921.2e6, 'R-GSM'))
+        self.assertTrue(arfcn.is_valid_downlink(934.8e6, 'R-GSM'))
+        self.assertFalse(arfcn.is_valid_downlink(921e6, 'R-GSM'))
+        self.assertFalse(arfcn.is_valid_downlink(935e6, 'R-GSM'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(1805.2e6, 'DCS1800'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(1879.8e6, 'DCS1800'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(1805e6, 'DCS1800'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(1880e6, 'DCS1800'))
+        self.assertTrue(arfcn.is_valid_downlink(1805.2e6, 'DCS1800'))
+        self.assertTrue(arfcn.is_valid_downlink(1879.8e6, 'DCS1800'))
+        self.assertFalse(arfcn.is_valid_downlink(1805e6, 'DCS1800'))
+        self.assertFalse(arfcn.is_valid_downlink(1880e6, 'DCS1800'))
         
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(1930.2e6, 'PCS1900'))
-        self.assertTrue(grgsm.arfcn.is_valid_downlink(1989.8e6, 'PCS1900'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(1930e6, 'PCS1900'))
-        self.assertFalse(grgsm.arfcn.is_valid_downlink(1990e6, 'PCS1900'))
+        self.assertTrue(arfcn.is_valid_downlink(1930.2e6, 'PCS1900'))
+        self.assertTrue(arfcn.is_valid_downlink(1989.8e6, 'PCS1900'))
+        self.assertFalse(arfcn.is_valid_downlink(1930e6, 'PCS1900'))
+        self.assertFalse(arfcn.is_valid_downlink(1990e6, 'PCS1900'))
         
     def test_004_arfcn2uplink(self):
-        self.assertEqual(450.6e6, grgsm.arfcn.arfcn2uplink(259, 'GSM450'))
-        self.assertEqual(457.4e6, grgsm.arfcn.arfcn2uplink(293, 'GSM450'))
+        self.assertEqual(450.6e6, arfcn.arfcn2uplink(259, 'GSM450'))
+        self.assertEqual(457.4e6, arfcn.arfcn2uplink(293, 'GSM450'))
         
-        self.assertEqual(479e6, grgsm.arfcn.arfcn2uplink(306, 'GSM480'))
-        self.assertEqual(485.8e6, grgsm.arfcn.arfcn2uplink(340, 'GSM480'))
+        self.assertEqual(479e6, arfcn.arfcn2uplink(306, 'GSM480'))
+        self.assertEqual(485.8e6, arfcn.arfcn2uplink(340, 'GSM480'))
         
-        self.assertEqual(824.2e6, grgsm.arfcn.arfcn2uplink(128, 'GSM850'))
-        self.assertEqual(848.8e6, grgsm.arfcn.arfcn2uplink(251, 'GSM850'))
+        self.assertEqual(824.2e6, arfcn.arfcn2uplink(128, 'GSM850'))
+        self.assertEqual(848.8e6, arfcn.arfcn2uplink(251, 'GSM850'))
         
-        self.assertEqual(890.2e6, grgsm.arfcn.arfcn2uplink(1, 'P-GSM'))
-        self.assertEqual(914.8e6, grgsm.arfcn.arfcn2uplink(124, 'P-GSM'))
+        self.assertEqual(890.2e6, arfcn.arfcn2uplink(1, 'P-GSM'))
+        self.assertEqual(914.8e6, arfcn.arfcn2uplink(124, 'P-GSM'))
         
-        self.assertEqual(880.2e6, grgsm.arfcn.arfcn2uplink(975, 'E-GSM'))
-        self.assertEqual(889.8e6, grgsm.arfcn.arfcn2uplink(1023, 'E-GSM'))
+        self.assertEqual(880.2e6, arfcn.arfcn2uplink(975, 'E-GSM'))
+        self.assertEqual(889.8e6, arfcn.arfcn2uplink(1023, 'E-GSM'))
         
-        self.assertEqual(876.2e6, grgsm.arfcn.arfcn2uplink(955, 'R-GSM'))
-        self.assertEqual(889.8e6, grgsm.arfcn.arfcn2uplink(1023, 'R-GSM'))
+        self.assertEqual(876.2e6, arfcn.arfcn2uplink(955, 'R-GSM'))
+        self.assertEqual(889.8e6, arfcn.arfcn2uplink(1023, 'R-GSM'))
         
-        self.assertEqual(1710.2e6, grgsm.arfcn.arfcn2uplink(512, 'DCS1800'))
-        self.assertEqual(1784.8e6, grgsm.arfcn.arfcn2uplink(885, 'DCS1800'))
+        self.assertEqual(1710.2e6, arfcn.arfcn2uplink(512, 'DCS1800'))
+        self.assertEqual(1784.8e6, arfcn.arfcn2uplink(885, 'DCS1800'))
         
-        self.assertEqual(1850.2e6, grgsm.arfcn.arfcn2uplink(512, 'PCS1900'))
-        self.assertEqual(1909.8e6, grgsm.arfcn.arfcn2uplink(810, 'PCS1900'))
+        self.assertEqual(1850.2e6, arfcn.arfcn2uplink(512, 'PCS1900'))
+        self.assertEqual(1909.8e6, arfcn.arfcn2uplink(810, 'PCS1900'))
         
     def test_005_arfcn2downlink(self):
-        self.assertEqual(460.6e6, grgsm.arfcn.arfcn2downlink(259, 'GSM450'))
-        self.assertEqual(467.4e6, grgsm.arfcn.arfcn2downlink(293, 'GSM450'))
+        self.assertEqual(460.6e6, arfcn.arfcn2downlink(259, 'GSM450'))
+        self.assertEqual(467.4e6, arfcn.arfcn2downlink(293, 'GSM450'))
         
-        self.assertEqual(489e6, grgsm.arfcn.arfcn2downlink(306, 'GSM480'))
-        self.assertEqual(495.8e6, grgsm.arfcn.arfcn2downlink(340, 'GSM480'))
+        self.assertEqual(489e6, arfcn.arfcn2downlink(306, 'GSM480'))
+        self.assertEqual(495.8e6, arfcn.arfcn2downlink(340, 'GSM480'))
         
-        self.assertEqual(869.2e6, grgsm.arfcn.arfcn2downlink(128, 'GSM850'))
-        self.assertEqual(893.8e6, grgsm.arfcn.arfcn2downlink(251, 'GSM850'))
+        self.assertEqual(869.2e6, arfcn.arfcn2downlink(128, 'GSM850'))
+        self.assertEqual(893.8e6, arfcn.arfcn2downlink(251, 'GSM850'))
         
-        self.assertEqual(935.2e6, grgsm.arfcn.arfcn2downlink(1, 'P-GSM'))
-        self.assertEqual(959.8e6, grgsm.arfcn.arfcn2downlink(124, 'P-GSM'))
+        self.assertEqual(935.2e6, arfcn.arfcn2downlink(1, 'P-GSM'))
+        self.assertEqual(959.8e6, arfcn.arfcn2downlink(124, 'P-GSM'))
         
-        self.assertEqual(925.2e6, grgsm.arfcn.arfcn2downlink(975, 'E-GSM'))
-        self.assertEqual(934.8e6, grgsm.arfcn.arfcn2downlink(1023, 'E-GSM'))
+        self.assertEqual(925.2e6, arfcn.arfcn2downlink(975, 'E-GSM'))
+        self.assertEqual(934.8e6, arfcn.arfcn2downlink(1023, 'E-GSM'))
         
-        self.assertEqual(921.2e6, grgsm.arfcn.arfcn2downlink(955, 'R-GSM'))
-        self.assertEqual(934.8e6, grgsm.arfcn.arfcn2downlink(1023, 'R-GSM'))
+        self.assertEqual(921.2e6, arfcn.arfcn2downlink(955, 'R-GSM'))
+        self.assertEqual(934.8e6, arfcn.arfcn2downlink(1023, 'R-GSM'))
         
-        self.assertEqual(1805.2e6, grgsm.arfcn.arfcn2downlink(512, 'DCS1800'))
-        self.assertEqual(1879.8e6, grgsm.arfcn.arfcn2downlink(885, 'DCS1800'))
+        self.assertEqual(1805.2e6, arfcn.arfcn2downlink(512, 'DCS1800'))
+        self.assertEqual(1879.8e6, arfcn.arfcn2downlink(885, 'DCS1800'))
         
-        self.assertEqual(1930.2e6, grgsm.arfcn.arfcn2downlink(512, 'PCS1900'))
-        self.assertEqual(1989.8e6, grgsm.arfcn.arfcn2downlink(810, 'PCS1900'))
+        self.assertEqual(1930.2e6, arfcn.arfcn2downlink(512, 'PCS1900'))
+        self.assertEqual(1989.8e6, arfcn.arfcn2downlink(810, 'PCS1900'))
         
     def test_006_uplink2arfcn(self):
-        self.assertEqual(259, grgsm.arfcn.uplink2arfcn(450.6e6, 'GSM450'))
-        self.assertEqual(293, grgsm.arfcn.uplink2arfcn(457.4e6, 'GSM450'))
+        self.assertEqual(259, arfcn.uplink2arfcn(450.6e6, 'GSM450'))
+        self.assertEqual(293, arfcn.uplink2arfcn(457.4e6, 'GSM450'))
         
-        self.assertEqual(306, grgsm.arfcn.uplink2arfcn(479e6, 'GSM480'))
-        self.assertEqual(340, grgsm.arfcn.uplink2arfcn(485.8e6, 'GSM480'))
+        self.assertEqual(306, arfcn.uplink2arfcn(479e6, 'GSM480'))
+        self.assertEqual(340, arfcn.uplink2arfcn(485.8e6, 'GSM480'))
         
-        self.assertEqual(128, grgsm.arfcn.uplink2arfcn(824.2e6, 'GSM850'))
-        self.assertEqual(251, grgsm.arfcn.uplink2arfcn(848.8e6, 'GSM850'))
+        self.assertEqual(128, arfcn.uplink2arfcn(824.2e6, 'GSM850'))
+        self.assertEqual(251, arfcn.uplink2arfcn(848.8e6, 'GSM850'))
         
-        self.assertEqual(1, grgsm.arfcn.uplink2arfcn(890.2e6, 'P-GSM'))
-        self.assertEqual(124, grgsm.arfcn.uplink2arfcn(914.8e6, 'P-GSM'))
+        self.assertEqual(1, arfcn.uplink2arfcn(890.2e6, 'P-GSM'))
+        self.assertEqual(124, arfcn.uplink2arfcn(914.8e6, 'P-GSM'))
         
-        self.assertEqual(975, grgsm.arfcn.uplink2arfcn(880.2e6, 'E-GSM'))
-        self.assertEqual(1023, grgsm.arfcn.uplink2arfcn(889.8e6, 'E-GSM'))
+        self.assertEqual(975, arfcn.uplink2arfcn(880.2e6, 'E-GSM'))
+        self.assertEqual(1023, arfcn.uplink2arfcn(889.8e6, 'E-GSM'))
         
-        self.assertEqual(955, grgsm.arfcn.uplink2arfcn(876.2e6, 'R-GSM'))
-        self.assertEqual(1023, grgsm.arfcn.uplink2arfcn(889.8e6, 'R-GSM'))
+        self.assertEqual(955, arfcn.uplink2arfcn(876.2e6, 'R-GSM'))
+        self.assertEqual(1023, arfcn.uplink2arfcn(889.8e6, 'R-GSM'))
         
-        self.assertEqual(512, grgsm.arfcn.uplink2arfcn(1710.2e6, 'DCS1800'))
-        self.assertEqual(885, grgsm.arfcn.uplink2arfcn(1784.8e6, 'DCS1800'))
+        self.assertEqual(512, arfcn.uplink2arfcn(1710.2e6, 'DCS1800'))
+        self.assertEqual(885, arfcn.uplink2arfcn(1784.8e6, 'DCS1800'))
         
-        self.assertEqual(512, grgsm.arfcn.uplink2arfcn(1850.2e6, 'PCS1900'))
-        self.assertEqual(810, grgsm.arfcn.uplink2arfcn(1909.8e6, 'PCS1900'))
+        self.assertEqual(512, arfcn.uplink2arfcn(1850.2e6, 'PCS1900'))
+        self.assertEqual(810, arfcn.uplink2arfcn(1909.8e6, 'PCS1900'))
         
     def test_007_downlink2arfcn(self):
-        self.assertEqual(259, grgsm.arfcn.downlink2arfcn(460.6e6, 'GSM450'))
-        self.assertEqual(293, grgsm.arfcn.downlink2arfcn(467.4e6, 'GSM450'))
+        self.assertEqual(259, arfcn.downlink2arfcn(460.6e6, 'GSM450'))
+        self.assertEqual(293, arfcn.downlink2arfcn(467.4e6, 'GSM450'))
         
-        self.assertEqual(306, grgsm.arfcn.downlink2arfcn(489e6, 'GSM480'))
-        self.assertEqual(340, grgsm.arfcn.downlink2arfcn(495.8e6, 'GSM480'))
+        self.assertEqual(306, arfcn.downlink2arfcn(489e6, 'GSM480'))
+        self.assertEqual(340, arfcn.downlink2arfcn(495.8e6, 'GSM480'))
         
-        self.assertEqual(128, grgsm.arfcn.downlink2arfcn(869.2e6, 'GSM850'))
-        self.assertEqual(251, grgsm.arfcn.downlink2arfcn(893.8e6, 'GSM850'))
+        self.assertEqual(128, arfcn.downlink2arfcn(869.2e6, 'GSM850'))
+        self.assertEqual(251, arfcn.downlink2arfcn(893.8e6, 'GSM850'))
         
-        self.assertEqual(1, grgsm.arfcn.downlink2arfcn(935.2e6, 'P-GSM'))
-        self.assertEqual(124, grgsm.arfcn.downlink2arfcn(959.8e6, 'P-GSM'))
+        self.assertEqual(1, arfcn.downlink2arfcn(935.2e6, 'P-GSM'))
+        self.assertEqual(124, arfcn.downlink2arfcn(959.8e6, 'P-GSM'))
         
-        self.assertEqual(975, grgsm.arfcn.downlink2arfcn(925.2e6, 'E-GSM'))
-        self.assertEqual(1023, grgsm.arfcn.downlink2arfcn(934.8e6, 'E-GSM'))
+        self.assertEqual(975, arfcn.downlink2arfcn(925.2e6, 'E-GSM'))
+        self.assertEqual(1023, arfcn.downlink2arfcn(934.8e6, 'E-GSM'))
         
-        self.assertEqual(955, grgsm.arfcn.downlink2arfcn(921.2e6, 'R-GSM'))
-        self.assertEqual(1023, grgsm.arfcn.downlink2arfcn(934.8e6, 'R-GSM'))
+        self.assertEqual(955, arfcn.downlink2arfcn(921.2e6, 'R-GSM'))
+        self.assertEqual(1023, arfcn.downlink2arfcn(934.8e6, 'R-GSM'))
         
-        self.assertEqual(512, grgsm.arfcn.downlink2arfcn(1805.2e6, 'DCS1800'))
-        self.assertEqual(885, grgsm.arfcn.downlink2arfcn(1879.8e6, 'DCS1800'))
+        self.assertEqual(512, arfcn.downlink2arfcn(1805.2e6, 'DCS1800'))
+        self.assertEqual(885, arfcn.downlink2arfcn(1879.8e6, 'DCS1800'))
         
-        self.assertEqual(512, grgsm.arfcn.downlink2arfcn(1930.2e6, 'PCS1900'))
-        self.assertEqual(810, grgsm.arfcn.downlink2arfcn(1989.8e6, 'PCS1900'))
+        self.assertEqual(512, arfcn.downlink2arfcn(1930.2e6, 'PCS1900'))
+        self.assertEqual(810, arfcn.downlink2arfcn(1989.8e6, 'PCS1900'))
         
     def test_008_firstarfcn(self):
-        self.assertEqual(259, grgsm.arfcn.get_first_arfcn('GSM450'))
-        self.assertEqual(306, grgsm.arfcn.get_first_arfcn('GSM480'))
-        self.assertEqual(128, grgsm.arfcn.get_first_arfcn('GSM850'))
-        self.assertEqual(1, grgsm.arfcn.get_first_arfcn('P-GSM'))
-        self.assertEqual(975, grgsm.arfcn.get_first_arfcn('E-GSM'))
-        self.assertEqual(955, grgsm.arfcn.get_first_arfcn('R-GSM'))
-        self.assertEqual(512, grgsm.arfcn.get_first_arfcn('DCS1800'))
-        self.assertEqual(512, grgsm.arfcn.get_first_arfcn('PCS1900'))
+        self.assertEqual(259, arfcn.get_first_arfcn('GSM450'))
+        self.assertEqual(306, arfcn.get_first_arfcn('GSM480'))
+        self.assertEqual(128, arfcn.get_first_arfcn('GSM850'))
+        self.assertEqual(1, arfcn.get_first_arfcn('P-GSM'))
+        self.assertEqual(975, arfcn.get_first_arfcn('E-GSM'))
+        self.assertEqual(955, arfcn.get_first_arfcn('R-GSM'))
+        self.assertEqual(512, arfcn.get_first_arfcn('DCS1800'))
+        self.assertEqual(512, arfcn.get_first_arfcn('PCS1900'))
 
     def test_009_firstarfcn(self):
-        self.assertEqual(293, grgsm.arfcn.get_last_arfcn('GSM450'))
-        self.assertEqual(340, grgsm.arfcn.get_last_arfcn('GSM480'))
-        self.assertEqual(251, grgsm.arfcn.get_last_arfcn('GSM850'))
-        self.assertEqual(124, grgsm.arfcn.get_last_arfcn('P-GSM'))
-        self.assertEqual(1023, grgsm.arfcn.get_last_arfcn('E-GSM'))
-        self.assertEqual(1023, grgsm.arfcn.get_last_arfcn('R-GSM'))
-        self.assertEqual(885, grgsm.arfcn.get_last_arfcn('DCS1800'))
-        self.assertEqual(810, grgsm.arfcn.get_last_arfcn('PCS1900'))        
+        self.assertEqual(293, arfcn.get_last_arfcn('GSM450'))
+        self.assertEqual(340, arfcn.get_last_arfcn('GSM480'))
+        self.assertEqual(251, arfcn.get_last_arfcn('GSM850'))
+        self.assertEqual(124, arfcn.get_last_arfcn('P-GSM'))
+        self.assertEqual(1023, arfcn.get_last_arfcn('E-GSM'))
+        self.assertEqual(1023, arfcn.get_last_arfcn('R-GSM'))
+        self.assertEqual(885, arfcn.get_last_arfcn('DCS1800'))
+        self.assertEqual(810, arfcn.get_last_arfcn('PCS1900'))        
         
 if __name__ == '__main__':
     gr_unittest.run(qa_arfcn, "qa_arfcn.xml")
diff --git a/python/qa_burst_fnr_filter.py b/python/qa_burst_fnr_filter.py
index cdd3ff4..93152df 100755
--- a/python/qa_burst_fnr_filter.py
+++ b/python/qa_burst_fnr_filter.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import pmt
 
 class qa_burst_fnr_filter (gr_unittest.TestCase):
diff --git a/python/qa_burst_printer.py b/python/qa_burst_printer.py
index 97fbe71..49c89e4 100755
--- a/python/qa_burst_printer.py
+++ b/python/qa_burst_printer.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import os
 import pmt
 import sys
diff --git a/python/qa_burst_sdcch_subslot_filter.py b/python/qa_burst_sdcch_subslot_filter.py
index 82136bf..9cb3cd5 100755
--- a/python/qa_burst_sdcch_subslot_filter.py
+++ b/python/qa_burst_sdcch_subslot_filter.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 
 class qa_burst_sdcch_subslot_filter (gr_unittest.TestCase):
     # 102 random bursts as test input
diff --git a/python/qa_burst_sdcch_subslot_splitter.py b/python/qa_burst_sdcch_subslot_splitter.py
index ff30c2b..1800137 100755
--- a/python/qa_burst_sdcch_subslot_splitter.py
+++ b/python/qa_burst_sdcch_subslot_splitter.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import pmt
 
 class qa_burst_sdcch_subslot_splitter (gr_unittest.TestCase):
diff --git a/python/qa_burst_timeslot_filter.py b/python/qa_burst_timeslot_filter.py
index 6c8fb2a..4c0f655 100755
--- a/python/qa_burst_timeslot_filter.py
+++ b/python/qa_burst_timeslot_filter.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import pmt
 
 class qa_burst_timeslot_filter (gr_unittest.TestCase):
diff --git a/python/qa_burst_timeslot_splitter.py b/python/qa_burst_timeslot_splitter.py
index b162a2e..cac9ae1 100755
--- a/python/qa_burst_timeslot_splitter.py
+++ b/python/qa_burst_timeslot_splitter.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import pmt
 
 class qa_burst_timeslot_splitter (gr_unittest.TestCase):
diff --git a/python/qa_controlled_fractional_resampler_cc.py b/python/qa_controlled_fractional_resampler_cc.py
new file mode 100755
index 0000000..417ab5b
--- /dev/null
+++ b/python/qa_controlled_fractional_resampler_cc.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# @file
+# @author Piotr Krysik <ptrkrysik@gmail.com>
+# @section LICENSE
+# 
+# Gr-gsm is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+# 
+# Gr-gsm is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with gr-gsm; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+# 
+# 
+
+from gnuradio import gr, gr_unittest
+from gnuradio import blocks
+import grgsm_swig as grgsm
+
+class qa_controlled_fractional_resampler_cc (gr_unittest.TestCase):
+
+    def setUp (self):
+        self.tb = gr.top_block ()
+
+    def tearDown (self):
+        self.tb = None
+
+    def test_001_t (self):
+        # set up fg
+        self.tb.run ()
+        # check data
+
+
+if __name__ == '__main__':
+    gr_unittest.run(qa_controlled_fractional_resampler_cc, "qa_controlled_fractional_resampler_cc.xml")
diff --git a/python/qa_decryption.py b/python/qa_decryption.py
index 08f0915..71feb62 100755
--- a/python/qa_decryption.py
+++ b/python/qa_decryption.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import pmt
 
 class qa_decryption (gr_unittest.TestCase):
diff --git a/python/qa_dummy_burst_filter.py b/python/qa_dummy_burst_filter.py
index 5a78890..a86a0e5 100755
--- a/python/qa_dummy_burst_filter.py
+++ b/python/qa_dummy_burst_filter.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 
 class qa_dummy_burst_filter (gr_unittest.TestCase):
 
diff --git a/python/qa_message_printer.py b/python/qa_message_printer.py
index 53a286f..4e54df1 100755
--- a/python/qa_message_printer.py
+++ b/python/qa_message_printer.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import os
 import pmt
 import sys
diff --git a/python/qa_message_source_sink.py b/python/qa_message_source_sink.py
index 7ed3608..a82b16f 100755
--- a/python/qa_message_source_sink.py
+++ b/python/qa_message_source_sink.py
@@ -22,7 +22,7 @@
 # 
 
 from gnuradio import gr, gr_unittest, blocks
-import grgsm
+import grgsm_swig as grgsm
 import os
 import pmt
 import sys
diff --git a/python/receiver/gsm_input.py b/python/receiver/gsm_input.py
index 97ab633..af5d4c3 100644
--- a/python/receiver/gsm_input.py
+++ b/python/receiver/gsm_input.py
@@ -1,96 +1,97 @@
-#!/usr/bin/env python
+# -*- coding: utf-8 -*-
 ##################################################
-# Gnuradio Python Flow Graph
+# GNU Radio Python Flow Graph
 # Title: GSM input adaptor
 # Author: Piotr Krysik
 # Description: 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.
-# Generated: Wed Nov 19 08:23:52 2014
+# Generated: Sun Jul 17 17:36:46 2016
 ##################################################
 
 from gnuradio import filter
 from gnuradio import gr
 from gnuradio.filter import firdes
-from distutils.version import LooseVersion as version
 import grgsm
 
+
 class gsm_input(grgsm.hier_block):
 
-    def __init__(self, ppm=0, osr=4, fc=940e6, samp_rate_in=1e6):
-        grgsm.hier_block.__init__(
+    def __init__(self, fc=940e6, osr=4, ppm=0, samp_rate_in=1e6):
+        gr.hier_block2.__init__(
             self, "GSM input adaptor",
             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_in")
 
         ##################################################
         # Parameters
         ##################################################
-        self.ppm = ppm
-        self.osr = osr
         self.fc = fc
+        self.osr = osr
+        self.ppm = ppm
         self.samp_rate_in = samp_rate_in
 
         ##################################################
         # Variables
         ##################################################
-        self.samp_rate_out = samp_rate_out = 1625000.0/6.0*osr
+        self.gsm_symb_rate = gsm_symb_rate = 1625000.0/6.0
+        self.samp_rate_out = samp_rate_out = gsm_symb_rate*osr
 
         ##################################################
         # Blocks
         ##################################################
-        self.message_port_register_hier_in("ppm_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,
+            ppm=ppm,
+            osr=osr,
         )
-        self.fractional_resampler_xx_0 = filter.fractional_resampler_cc(0, samp_rate_in/samp_rate_out)
 
         ##################################################
         # Connections
         ##################################################
-        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))
-
-        ##################################################
-        # Asynch Message Connections
-        ##################################################
-        self.msg_connect(self, "ppm_in", self.gsm_clock_offset_corrector_0, "ppm_in")
-
-
-    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 get_osr(self):
-        return self.osr
-
-    def set_osr(self, osr):
-        self.osr = osr
-        self.set_samp_rate_out(1625000.0/6.0*self.osr)
+        self.msg_connect((self, 'ctrl_in'), (self.gsm_clock_offset_corrector_tagged_0, 'ctrl'))    
+        self.connect((self.gsm_clock_offset_corrector_tagged_0, 0), (self.low_pass_filter_0_0, 0))    
+        self.connect((self.low_pass_filter_0_0, 0), (self, 0))    
+        self.connect((self, 0), (self.gsm_clock_offset_corrector_tagged_0, 0))    
 
     def get_fc(self):
         return self.fc
 
     def set_fc(self, fc):
         self.fc = fc
-        self.gsm_clock_offset_corrector_0.set_fc(self.fc)
+        self.gsm_clock_offset_corrector_tagged_0.set_fc(self.fc)
+
+    def get_osr(self):
+        return self.osr
+
+    def set_osr(self, osr):
+        self.osr = osr
+        self.set_samp_rate_out(self.gsm_symb_rate*self.osr)
+        self.gsm_clock_offset_corrector_tagged_0.set_osr(self.osr)
+
+    def get_ppm(self):
+        return self.ppm
+
+    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.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)
+        self.gsm_clock_offset_corrector_tagged_0.set_samp_rate_in(self.samp_rate_in)
+
+    def get_gsm_symb_rate(self):
+        return self.gsm_symb_rate
+
+    def set_gsm_symb_rate(self, gsm_symb_rate):
+        self.gsm_symb_rate = gsm_symb_rate
+        self.set_samp_rate_out(self.gsm_symb_rate*self.osr)
 
     def get_samp_rate_out(self):
         return self.samp_rate_out
@@ -98,5 +99,3 @@
     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)
-
diff --git a/swig/grgsm_swig.i b/swig/grgsm_swig.i
index 81a5942..f823287 100644
--- a/swig/grgsm_swig.i
+++ b/swig/grgsm_swig.i
@@ -23,7 +23,6 @@
 #include "grgsm/flow_control/burst_fnr_filter.h"
 #include "grgsm/flow_control/dummy_burst_filter.h"
 #include "grgsm/misc_utils/bursts_printer.h"
-#include "grgsm/misc_utils/controlled_const_source_f.h"
 #include "grgsm/misc_utils/controlled_rotator_cc.h"
 #include "grgsm/misc_utils/extract_system_info.h"
 #include "grgsm/misc_utils/extract_immediate_assignment.h"
@@ -37,7 +36,8 @@
 #include "grgsm/qa_utils/message_sink.h"
 #include "grgsm/misc_utils/message_file_sink.h"
 #include "grgsm/misc_utils/message_file_source.h"
-#include "grgsm/msg_to_tag.h"
+#include "grgsm/misc_utils/msg_to_tag.h"
+#include "grgsm/misc_utils/controlled_fractional_resampler_cc.h"
 %}
 
 %include "grgsm/receiver/receiver.h"
@@ -85,8 +85,6 @@
 GR_SWIG_BLOCK_MAGIC2(gsm, extract_immediate_assignment);
 %include "grgsm/misc_utils/controlled_rotator_cc.h"
 GR_SWIG_BLOCK_MAGIC2(gsm, controlled_rotator_cc);
-%include "grgsm/misc_utils/controlled_const_source_f.h"
-GR_SWIG_BLOCK_MAGIC2(gsm, controlled_const_source_f);
 %include "grgsm/misc_utils/message_printer.h"
 GR_SWIG_BLOCK_MAGIC2(gsm, message_printer);
 %include "grgsm/misc_utils/tmsi_dumper.h"
@@ -95,6 +93,11 @@
 GR_SWIG_BLOCK_MAGIC2(gsm, message_file_sink);
 %include "grgsm/misc_utils/message_file_source.h"
 GR_SWIG_BLOCK_MAGIC2(gsm, message_file_source);
+%include "grgsm/misc_utils/msg_to_tag.h"
+GR_SWIG_BLOCK_MAGIC2(gsm, msg_to_tag);
+%include "grgsm/misc_utils/controlled_fractional_resampler_cc.h"
+GR_SWIG_BLOCK_MAGIC2(gsm, controlled_fractional_resampler_cc);
+
 
 %include "grgsm/qa_utils/burst_sink.h"
 GR_SWIG_BLOCK_MAGIC2(gsm, burst_sink);
@@ -104,5 +107,3 @@
 GR_SWIG_BLOCK_MAGIC2(gsm, message_source);
 %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);
diff --git a/tests/dockerfiles/Ubuntu_16_04_debinstall.docker b/tests/dockerfiles/Ubuntu_16_04_debinstall.docker
new file mode 100644
index 0000000..0a476ce
--- /dev/null
+++ b/tests/dockerfiles/Ubuntu_16_04_debinstall.docker
@@ -0,0 +1,13 @@
+FROM ubuntu:16.04
+MAINTAINER Ash Wilson
+
+RUN apt-get update && apt-get install -y \
+    software-properties-common
+
+RUN add-apt-repository -y ppa:ptrkrysik/gr-gsm
+
+RUN apt-get update && apt-get install -y \
+    gr-gsm
+
+COPY ./ /src/
+RUN ls /src
diff --git a/tests/fixtures/grgsm_decode_test1_expected b/tests/fixtures/grgsm_decode_test1_expected
index eb78bb9..ce19917 100644
--- a/tests/fixtures/grgsm_decode_test1_expected
+++ b/tests/fixtures/grgsm_decode_test1_expected
@@ -1,7 +1,3 @@
-860912 1330176:  15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
-860916 1330308:  15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
-860922 1330506:  15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
-860926 1330638:  15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
 860933 1329237:  59 06 1a 8f 6d 18 10 80 00 00 00 00 00 00 00 00 00 00 00 78 b9 00 00
 860937 1329369:  05 06 20 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
 860943 1329541:  15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
diff --git a/tests/scripts/decode.sh b/tests/scripts/decode.sh
index 014a5d3..3fb90ff 100755
--- a/tests/scripts/decode.sh
+++ b/tests/scripts/decode.sh
@@ -7,7 +7,7 @@
 export SHORTENED_CAPFILE="tmp.cfile"
 export RESULT_EXPECTED="../fixtures/grgsm_decode_test1_expected"
 export RESULT_OBTAINED="grgsm_decode_test1_result"
-export RUNLINE="$AP_DECODE -c $SHORTENED_CAPFILE -s $((100000000/174)) -m BCCH -t 0 -v "
+export RUNLINE="$AP_DECODE -c $SHORTENED_CAPFILE -s $((100000000/174)) -m BCCH -t 0 -v --ppm -10"
 echo "Testing with:"
 echo "  $RUNLINE"
 gnuradio-companion --version
@@ -15,7 +15,7 @@
 cd $TEST_DIR
 cat $CAPFILE | head -c 6000000 > $SHORTENED_CAPFILE
 
-$RUNLINE | tail -n +4 | tee $RESULT_OBTAINED
+$RUNLINE | grep -A 999999 "860933 1329237:  59 06 1a 8f 6d 18 10 80 00 00 00 00 00 00 00 00 00 00 00 78 b9 00 00" | tee $RESULT_OBTAINED
 diff $RESULT_EXPECTED $RESULT_OBTAINED
 TEST_RESULT=$?
 
@@ -30,3 +30,4 @@
   echo "   Result: FAILED"
   exit 1
 fi
+