diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8e8499ec2d3b7d3e7a7c91b965a816996ab006e1..8037f7db6aa3c201247f4268a35df4c16985d521 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -526,6 +526,7 @@ unit_test:
         path: tangostationcontrol/coverage.xml
     paths:
       - tangostationcontrol/cover/*
+      - tangostationcontrol/.coverage
 integration_test_docker:
   stage: integration-tests
   image: docker:latest
@@ -535,6 +536,8 @@ integration_test_docker:
     - name: docker:dind
   variables:
     DOCKER_TLS_CERTDIR: "/certs"
+  needs:
+    - unit_test
   artifacts:
     when: always
     paths:
diff --git a/README.md b/README.md
index b8f08504fbcd221ac8a0ed3e4e6c98869b242f11..c72d120f54c46d5bf9eba273863b4572de9595ff 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ Station Control software related to Tango devices.
   * [Attribute wrapper documentation](tangostationcontrol/tangostationcontrol/clients/README.md)
   * [Archiver documentation](tangostationcontrol/tangostationcontrol/toolkit/README.md)
   * [Adding a new tango device](tangostationcontrol/tangostationcontrol/devices/README.md)
-  * [HDF5 statistics](tangostationcontrol/tangostationcontrol/statistics_writer/README.md)
+  * [HDF5 statistics](tangostationcontrol/tangostationcontrol/statistics/README.md)
 * [Unit tests](tangostationcontrol/tangostationcontrol/test/README.md)
 * [Integration tests](tangostationcontrol/tangostationcontrol/integration_test/README.md)
 
diff --git a/tangostationcontrol/setup.cfg b/tangostationcontrol/setup.cfg
index 0fe48b128f13c2e09ccca534cf0b5fa609aee02b..bdb3dbae7df1071b616c769342155349fde7ca65 100644
--- a/tangostationcontrol/setup.cfg
+++ b/tangostationcontrol/setup.cfg
@@ -50,8 +50,8 @@ console_scripts =
     l2ss-sdp = tangostationcontrol.devices.sdp.sdp:main
     l2ss-bst = tangostationcontrol.devices.sdp.bst:main
     l2ss-sst = tangostationcontrol.devices.sdp.sst:main
-    l2ss-statistics-reader = tangostationcontrol.statistics_writer.statistics_reader:main
-    l2ss-statistics-writer = tangostationcontrol.statistics.writer:main
+    l2ss-statistics-reader = tangostationcontrol.statistics.reader:main
+    l2ss-statistics-writer = tangostationcontrol.statistics.writer.entry:main
     l2ss-unb2 = tangostationcontrol.devices.unb2:main
     l2ss-xst = tangostationcontrol.devices.sdp.xst:main
     l2ss-temperature-manager = tangostationcontrol.devices.temperature_manager:main
diff --git a/tangostationcontrol/tangostationcontrol/integration_test/default/statistics/test_writer_sst.py b/tangostationcontrol/tangostationcontrol/integration_test/default/statistics/test_writer_sst.py
index 19f27af5b121979ceeefba746a4bb863e2e00352..d8932263df5079790e14cdd988f73c3224e8c53a 100644
--- a/tangostationcontrol/tangostationcontrol/integration_test/default/statistics/test_writer_sst.py
+++ b/tangostationcontrol/tangostationcontrol/integration_test/default/statistics/test_writer_sst.py
@@ -11,8 +11,8 @@ from tangostationcontrol.integration_test.base import BaseIntegrationTestCase
 from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy
 
 from tangostationcontrol.statistics.collector import StationSSTCollector
-from tangostationcontrol.statistics_writer import statistics_reader
-from tangostationcontrol.statistics import writer
+from tangostationcontrol.statistics import reader
+from tangostationcontrol.statistics.writer import entry
 
 import sys
 from os.path import dirname, isfile, join
@@ -76,9 +76,9 @@ class TestStatisticsWriterSST(BaseIntegrationTestCase):
                 ""
                 "--output_dir", tmpdir
             ]
-            with mock.patch.object(writer.sys, 'argv', new_sys_argv):
+            with mock.patch.object(entry.sys, 'argv', new_sys_argv):
                 with self.assertRaises(SystemExit):
-                    writer.main()
+                    entry.main()
 
             # check if file was written
             self.assertTrue(isfile(f"{tmpdir}/SST_2021-09-20-12-17-40.h5"))
@@ -90,8 +90,8 @@ class TestStatisticsWriterSST(BaseIntegrationTestCase):
                 "--start_time", "2021-09-20#07:40:08.937+00:00",
                 "--end_time", "2021-10-04#07:50:08.937+00:00"
             ]
-            with mock.patch.object(statistics_reader.sys, 'argv', new_sys_argv):           
-                stat_parser = statistics_reader.setup_stat_parser()
+            with mock.patch.object(reader.sys, 'argv', new_sys_argv):
+                stat_parser = reader.setup_stat_parser()
                 SSTstatistics = stat_parser.list_statistics()
                 self.assertIsNotNone(SSTstatistics)
                 # same as stat_parser.statistics[0]
@@ -118,9 +118,9 @@ class TestStatisticsWriterSST(BaseIntegrationTestCase):
                 "--output_dir", tmpdir
             ]
 
-            with mock.patch.object(writer.sys, 'argv', new_sys_argv):
+            with mock.patch.object(entry.sys, 'argv', new_sys_argv):
                 with self.assertRaises(SystemExit):
-                    writer.main()
+                    entry.main()
             
             # check if file was written
             self.assertTrue(isfile(f"{tmpdir}/SST_2021-09-20-12-17-40.h5"))
@@ -132,8 +132,8 @@ class TestStatisticsWriterSST(BaseIntegrationTestCase):
                 "--start_time", "2021-09-20#07:40:08.937+00:00",
                 "--end_time", "2021-10-04#07:50:08.937+00:00"
             ]
-            with mock.patch.object(statistics_reader.sys, 'argv', new_sys_argv):           
-                stat_parser = statistics_reader.setup_stat_parser()
+            with mock.patch.object(reader.sys, 'argv', new_sys_argv):
+                stat_parser = reader.setup_stat_parser()
                 SSTstatistics = stat_parser.list_statistics()
                 self.assertIsNotNone(SSTstatistics)
                 # same as stat_parser.statistics[0]
@@ -153,21 +153,33 @@ class TestStatisticsWriterSST(BaseIntegrationTestCase):
         self.assertEqual(DevState.OFF, self.recv_proxy.state())
 
         with TemporaryDirectory() as tmpdir:
-            new_sys_argv = [sys.argv[0], "--mode", "SST", "--file", join(dirname(dirname(dirname(dirname(__file__)))), "test/statistics", "SDP_SST_statistics_packets.bin"), "--output_dir", tmpdir]
-            with mock.patch.object(writer.sys, 'argv', new_sys_argv):
+            new_sys_argv = [
+                sys.argv[0],
+                "--mode", "SST",
+                "--file", join(
+                    dirname(dirname(dirname(dirname(__file__)))),
+                    "test/statistics", "SDP_SST_statistics_packets.bin"
+                ), "--output_dir", tmpdir
+            ]
+            with mock.patch.object(entry.sys, 'argv', new_sys_argv):
                 with self.assertRaises(SystemExit):
-                    writer.main()
+                    entry.main()
 
             # check if file was written
             self.assertTrue(isfile(f"{tmpdir}/SST_2021-09-20-12-17-40.h5"))
 
             # test statistics reader
-            new_sys_argv = [sys.argv[0], "--files", f"{tmpdir}/SST_2021-09-20-12-17-40.h5", "--start_time", "2021-09-20#07:40:08.937+00:00", "--end_time", "2021-10-04#07:50:08.937+00:00"]
-            with mock.patch.object(statistics_reader.sys, 'argv', new_sys_argv):           
-                stat_parser = statistics_reader.setup_stat_parser()
+            new_sys_argv = [
+                sys.argv[0],
+                "--files", f"{tmpdir}/SST_2021-09-20-12-17-40.h5",
+                "--start_time", "2021-09-20#07:40:08.937+00:00",
+                "--end_time", "2021-10-04#07:50:08.937+00:00"
+            ]
+            with mock.patch.object(reader.sys, 'argv', new_sys_argv):
+                stat_parser = reader.setup_stat_parser()
                 SSTstatistics = stat_parser.list_statistics()
                 self.assertIsNotNone(SSTstatistics)
-                stat = stat_parser.get_statistic('2021-09-20T12:17:40.000+00:00') # same as stat_parser.statistics[0] 
+                stat = stat_parser.get_statistic('2021-09-20T12:17:40.000+00:00')  # same as stat_parser.statistics[0]
                 self.assertIsNotNone(stat)
                 self.assertEqual(121, stat.data_id_signal_input_index)
                 # Test RECV attributes      
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/README.md b/tangostationcontrol/tangostationcontrol/statistics/README.md
similarity index 70%
rename from tangostationcontrol/tangostationcontrol/statistics_writer/README.md
rename to tangostationcontrol/tangostationcontrol/statistics/README.md
index 378ec13c1ff5dd75bfdb3d92cb5ed0a5085edcab..ad2a9d3e894dcc2d16c04060487832cc62db8b78 100644
--- a/tangostationcontrol/tangostationcontrol/statistics_writer/README.md
+++ b/tangostationcontrol/tangostationcontrol/statistics/README.md
@@ -1,9 +1,12 @@
 # TCP to HDF5 statistics writer
-The TCP to HDF5 statistics writer can be started with `statistics_writer.py` This script imports the receiver script and `HDF5Writer.py`. `receiver.py` only takes care of receiving packets. 
-`HDF5Writer.py` takes the receive function from the receiver and uses it to obtain packets. 
-Any function that can deliver statistics packets can be used by this code. 
-`HDF5Writer.py` takes care of processing the packets it receives, filling statistics matrices
-and writing those matrices (as well as a bunch of metadata) to hdf5.
+
+The TCP to HDF5 statistics writer can be started with `statistics_writer.py`
+This script imports the receiver script and `HDF5Writer.py`. `receiver.py` only
+takes care of receiving packets. `HDF5Writer.py` takes the receive function from
+the receiver and uses it to obtain packets.  Any function that can deliver
+statistics packets can be used by this code. `HDF5Writer.py` takes care of
+processing the packets it receives, filling statistics matrices and writing
+those matrices (as well as a bunch of metadata) to hdf5.
 
 
 ### TCP Statistics writer
@@ -21,14 +24,19 @@ This script can be called with the following arguments:
   -d  --decimation  Configure the writer to only store one every n samples. Saves storage space (default: 1 (everything))
   -r  --reconnect   Set the writer to keep trying to reconnect whenever connection is lost. (default: off)
   ```
-An example call could be: `l2ss-statistics-writer statistics_writer.py --host localhost --port 1234 --mode XST --debug`
-This starts the script up to listen on localhost:1234 for XST's with debug mode on. 
+An example call could be:
 
-## HFD5 structure
-Statistics packets are collected by the StatisticsCollector in to a matrix. Once the matrix is done or a newer 
-timestamp arrives this matrix along with the header of first packet header, nof_payload_errors and nof_valid_payloads.
-The file will be named after the mode it is in and the timestamp of the statistics packets. For example: `SST_1970-01-01-00-00-00.h5`.
+```l2ss-statistics-writer --host localhost --port 1234--mode XST --debug```
+
+This starts the script up to listen on localhost:1234 for XSTs with debug mode
+on. 
 
+## HFD5 structure
+Statistics packets are collected by the StatisticsCollector in to a matrix. Once
+the matrix is done or a newer timestamp arrives this matrix along with the
+header of first packet header, nof_payload_errors and nof_valid_payloads. The
+file will be named after the mode it is in and the timestamp of the statistics
+packets. For example: `SST_1970-01-01-00-00-00.h5`.
 
 ```
 File
@@ -47,8 +55,11 @@ File
 ```
 
 ### reader
-There is a statistics reader that is capable of parsing multiple HDF5 statistics files in to
-a more easily usable format. It also allows for filtering between certain timestamps.
+
+There is a statistics reader that is capable of parsing multiple HDF5 statistics
+files in to  a more easily usable format. It also allows for filtering between
+certain timestamps.
+
 `statistics_reader.py` takes the following arguments:
 `--files        list of files to parse`
 `--end_time     highest timestamp to process in isoformat`
diff --git a/tangostationcontrol/tangostationcontrol/statistics/packet.py b/tangostationcontrol/tangostationcontrol/statistics/packet.py
deleted file mode 100644
index 87383704daf73fc77e2a34d7d329c6e0246725e2..0000000000000000000000000000000000000000
--- a/tangostationcontrol/tangostationcontrol/statistics/packet.py
+++ /dev/null
@@ -1,88 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# This file is part of the LOFAR 2.0 Station Software
-#
-#
-#
-# Distributed under the terms of the APACHE license.
-# See LICENSE.txt for more info.
-
-import sys
-import pprint
-
-from lofar_station_client.statistics.packet import SDPPacket
-from lofar_station_client.statistics.packet import PACKET_CLASS_FOR_MARKER
-
-
-def read_packet(read_func) -> SDPPacket:
-    """Read a packet using the given read function, with signature
-
-        ```read_func(num_bytes: int) -> bytes```
-
-    and return it. The packet type is sensed from the data and
-    the correct subclass of SDPPacket is returned.
-
-    If read_func() returns None, this function will as well.
-    """
-
-    # read just the marker
-    marker = read_func(1)
-    if not marker:
-        return None
-
-    # read the packet header based on type
-    packetClass = PACKET_CLASS_FOR_MARKER[marker]
-
-    # read the rest of the header
-    header = read_func(packetClass.HEADER_SIZE - len(marker))
-    if not header:
-        return None
-
-    header = marker + header
-
-    # parse the packet header size
-    packet = packetClass(header)
-
-    # read the payload
-    payload_size = packet.expected_size() - len(header)
-    payload = read_func(payload_size)
-
-    if not payload:
-        return None
-
-    # return full packet
-    return packetClass(header + payload)
-
-
-def main(args=None, **kwargs):
-    # parse one packet from stdin
-
-    # packet counter
-    nr = 0
-
-    # byte offset in the stream
-    offset = 0
-
-    while True:
-        # read the packet from input
-        packet = read_packet(sys.stdin.buffer.read)
-
-        if not packet:
-            break
-
-        # print header
-        print(
-            f"# Packet {nr} of class {packet.__class__.__name__} starting at "
-            f"offset {offset} with length {packet.size()}"
-        )
-        pprint.pprint(packet.header())
-
-        # increment counters
-        nr += 1
-        offset += packet.size()
-
-
-# this file is very useful to have stand alone to parse raw packet files, so make it
-# work as such
-if __name__ == "__main__":
-    main(sys.argv)
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/statistics_reader.py b/tangostationcontrol/tangostationcontrol/statistics/reader.py
similarity index 99%
rename from tangostationcontrol/tangostationcontrol/statistics_writer/statistics_reader.py
rename to tangostationcontrol/tangostationcontrol/statistics/reader.py
index 54755e6d67ed60cb3c4c5d5eb2d1c3bddb2f3536..cb9370fd206440de37f31bdbaae7218f71470726 100644
--- a/tangostationcontrol/tangostationcontrol/statistics_writer/statistics_reader.py
+++ b/tangostationcontrol/tangostationcontrol/statistics/reader.py
@@ -164,7 +164,6 @@ class statistics_data:
                 "data_id_subband_index", "data_id_first_baseline", "data_id_beamlet_index", "nof_valid_payloads", "nof_payload_errors", "values", 
                 "rcu_attenuator_dB", "rcu_band_select", "rcu_dth_on")
 
-
     def __init__(self, file, group_key):
 
         # get all the general header info
@@ -218,6 +217,7 @@ class statistics_data:
         self.nof_payload_errors = numpy.array(file.get(f"{group_key}/nof_payload_errors"))
         self.values = numpy.array(file.get(f"{group_key}/values"))
 
+
 def parse_arguments():
     """
     This function parses the input arguments.
@@ -243,6 +243,7 @@ def parse_arguments():
 
     return files, end_time, start_time
 
+
 def setup_stat_parser():
     """
     This function takes care of setting up the statistics parser with the end_time, start_time and files arguments
@@ -267,6 +268,7 @@ def setup_stat_parser():
 
     return stat_parser
 
+
 def main():
 
     # set up everything
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/receiver.py b/tangostationcontrol/tangostationcontrol/statistics/receiver.py
similarity index 99%
rename from tangostationcontrol/tangostationcontrol/statistics_writer/receiver.py
rename to tangostationcontrol/tangostationcontrol/statistics/receiver.py
index 233b819c5173fcfefc010f9025563ddcaef3e65c..b9c823c2a822cd4aee4a02bf6e921246e7dec471 100644
--- a/tangostationcontrol/tangostationcontrol/statistics_writer/receiver.py
+++ b/tangostationcontrol/tangostationcontrol/statistics/receiver.py
@@ -12,6 +12,7 @@ import socket
 
 from lofar_station_client.statistics.packet import StatisticsPacket
 
+
 class receiver:
     """ Reads data from a file descriptor. """
 
@@ -57,6 +58,7 @@ class receiver:
 
         return data
 
+
 class tcp_receiver(receiver):
     def __init__(self, HOST, PORT):
         self.host = HOST
@@ -79,7 +81,6 @@ class tcp_receiver(receiver):
         return True
 
 
-
 class file_receiver(receiver):
     def __init__(self, filename):
         self.filename = filename
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/__init__.py b/tangostationcontrol/tangostationcontrol/statistics/udp_dev/__init__.py
similarity index 100%
rename from tangostationcontrol/tangostationcontrol/statistics_writer/__init__.py
rename to tangostationcontrol/tangostationcontrol/statistics/udp_dev/__init__.py
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/udp_dev/udp_client.py b/tangostationcontrol/tangostationcontrol/statistics/udp_dev/udp_client.py
similarity index 98%
rename from tangostationcontrol/tangostationcontrol/statistics_writer/udp_dev/udp_client.py
rename to tangostationcontrol/tangostationcontrol/statistics/udp_dev/udp_client.py
index ea5a644f10985257452b4d93249cea36c37708e9..98a85d62d1d3e610ed747b49f5034eb1dc3afeec 100644
--- a/tangostationcontrol/tangostationcontrol/statistics_writer/udp_dev/udp_client.py
+++ b/tangostationcontrol/tangostationcontrol/statistics/udp_dev/udp_client.py
@@ -4,6 +4,7 @@ import netifaces as ni
 from datetime import datetime
 import time
 
+
 class UDP_Client:
 
     def __init__(self, server_ip:str, server_port:int):
@@ -40,6 +41,7 @@ class UDP_Client:
         # close the socket
         s.close()
 
+
 if __name__ == '__main__':
 
     if len(sys.argv) == 3:
@@ -56,7 +58,3 @@ if __name__ == '__main__':
 
     client = UDP_Client(server_ip,server_port)
     client.run()
-
-    
-        
-        
\ No newline at end of file
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/udp_dev/udp_server.py b/tangostationcontrol/tangostationcontrol/statistics/udp_dev/udp_server.py
similarity index 99%
rename from tangostationcontrol/tangostationcontrol/statistics_writer/udp_dev/udp_server.py
rename to tangostationcontrol/tangostationcontrol/statistics/udp_dev/udp_server.py
index 35ccb6bd92975bcfbd2ea877e5e5b38c3962b0c5..aab1365dfa661b0bef5ab280f1fe0f32ebbb493a 100644
--- a/tangostationcontrol/tangostationcontrol/statistics_writer/udp_dev/udp_server.py
+++ b/tangostationcontrol/tangostationcontrol/statistics/udp_dev/udp_server.py
@@ -43,6 +43,7 @@ class UDP_Server:
     def get_recv_data(self):
         return self.recv_data
 
+
 if __name__ == '__main__':
     local_ip = ni.ifaddresses('eth0')[ni.AF_INET][0]['addr']
     server = UDP_Server(local_ip,5600)
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/udp_dev/udp_write_manager.py b/tangostationcontrol/tangostationcontrol/statistics/udp_dev/udp_write_manager.py
similarity index 100%
rename from tangostationcontrol/tangostationcontrol/statistics_writer/udp_dev/udp_write_manager.py
rename to tangostationcontrol/tangostationcontrol/statistics/udp_dev/udp_write_manager.py
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/test/__init__.py b/tangostationcontrol/tangostationcontrol/statistics/writer/__init__.py
similarity index 100%
rename from tangostationcontrol/tangostationcontrol/statistics_writer/test/__init__.py
rename to tangostationcontrol/tangostationcontrol/statistics/writer/__init__.py
diff --git a/tangostationcontrol/tangostationcontrol/statistics/writer.py b/tangostationcontrol/tangostationcontrol/statistics/writer/entry.py
similarity index 94%
rename from tangostationcontrol/tangostationcontrol/statistics/writer.py
rename to tangostationcontrol/tangostationcontrol/statistics/writer/entry.py
index 020151b9523767aee745a2229ebe9e4935fc55b8..0b3c60484c893d76918e0e926cd1a9c8114974d8 100644
--- a/tangostationcontrol/tangostationcontrol/statistics/writer.py
+++ b/tangostationcontrol/tangostationcontrol/statistics/writer/entry.py
@@ -12,10 +12,11 @@ import time
 import sys
 from tango import DeviceProxy
 
-from tangostationcontrol.statistics_writer.receiver import tcp_receiver, file_receiver
-from tangostationcontrol.statistics_writer.hdf5_writer import BstHdf5Writer
-from tangostationcontrol.statistics_writer.hdf5_writer import SstHdf5Writer
-from tangostationcontrol.statistics_writer.hdf5_writer import ParallelXstHdf5Writer
+from tangostationcontrol.statistics.receiver import file_receiver
+from tangostationcontrol.statistics.receiver import tcp_receiver
+from tangostationcontrol.statistics.writer.hdf5 import BstHdf5Writer
+from tangostationcontrol.statistics.writer.hdf5 import SstHdf5Writer
+from tangostationcontrol.statistics.writer.hdf5 import ParallelXstHdf5Writer
 
 import logging
 
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/hdf5_writer.py b/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py
similarity index 100%
rename from tangostationcontrol/tangostationcontrol/statistics_writer/hdf5_writer.py
rename to tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/SST_2021-10-04-07-36-52.h5 b/tangostationcontrol/tangostationcontrol/statistics_writer/SST_2021-10-04-07-36-52.h5
deleted file mode 100644
index 26179fc59a2fb032bb35d779676befd4ebe26356..0000000000000000000000000000000000000000
Binary files a/tangostationcontrol/tangostationcontrol/statistics_writer/SST_2021-10-04-07-36-52.h5 and /dev/null differ
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/test/SST_10m_test_1.h5 b/tangostationcontrol/tangostationcontrol/statistics_writer/test/SST_10m_test_1.h5
deleted file mode 100644
index 2d04a526e1ef73d7bd636e3b564192d95e49cef5..0000000000000000000000000000000000000000
Binary files a/tangostationcontrol/tangostationcontrol/statistics_writer/test/SST_10m_test_1.h5 and /dev/null differ
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/test/SST_10m_test_2.h5 b/tangostationcontrol/tangostationcontrol/statistics_writer/test/SST_10m_test_2.h5
deleted file mode 100644
index 45fd32d831508f8d632c6f1778d4d9bb73059294..0000000000000000000000000000000000000000
Binary files a/tangostationcontrol/tangostationcontrol/statistics_writer/test/SST_10m_test_2.h5 and /dev/null differ
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/test/SST_10m_test_3.h5 b/tangostationcontrol/tangostationcontrol/statistics_writer/test/SST_10m_test_3.h5
deleted file mode 100644
index 5c971e8e2cea131d6c9ba8b7e6b1d645f205f276..0000000000000000000000000000000000000000
Binary files a/tangostationcontrol/tangostationcontrol/statistics_writer/test/SST_10m_test_3.h5 and /dev/null differ
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/test/devices_test_SDP_SST_statistics_packets.bin b/tangostationcontrol/tangostationcontrol/statistics_writer/test/devices_test_SDP_SST_statistics_packets.bin
deleted file mode 100644
index e94347b86a0a03b940eb84980ec8f6d3b6d4e2d7..0000000000000000000000000000000000000000
Binary files a/tangostationcontrol/tangostationcontrol/statistics_writer/test/devices_test_SDP_SST_statistics_packets.bin and /dev/null differ
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/test/test_server.py b/tangostationcontrol/tangostationcontrol/statistics_writer/test/test_server.py
deleted file mode 100644
index 74101b93de2e83824c70e4630e8560ae24b28fa8..0000000000000000000000000000000000000000
--- a/tangostationcontrol/tangostationcontrol/statistics_writer/test/test_server.py
+++ /dev/null
@@ -1,55 +0,0 @@
-import socket
-import time
-
-import argparse
-
-import logging
-logging.basicConfig(level=logging.INFO)
-logger = logging.getLogger("statistics_test_server")
-logger.setLevel(logging.DEBUG)
-
-parser = argparse.ArgumentParser(description='Select what hostname to use and what port to use')
-parser.add_argument('--port', type=int, help='port to use', default=65433)
-parser.add_argument('--host',  help='host to use', default='127.0.0.1')
-parser.add_argument('--file',  help='file to use as data', default='devices_test_SDP_SST_statistics_packets.bin')
-parser.add_argument('--interval', type=int,  help='ime between sending entire files content', default=1)
-
-args = parser.parse_args()
-HOST = args.host
-PORT = args.port
-FILE = args.file
-INTERVAL = args.interval
-
-
-while True:
-    try:
-        f = open(FILE, "rb")
-        data = f.read()
-    except Exception as e:
-        logger.error(f"File not found, are you sure: '{FILE}' is a valid path, Exception: {e}")
-        exit()
-
-    try:
-        with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
-            logger.debug(f"Starting TCP test server on {HOST} {PORT}")
-            logger.debug("To interrupt the script, press Ctrl-C twice within a second")
-
-            s.bind((HOST, PORT))
-            s.listen()
-            conn, addr = s.accept()
-
-            with conn:
-                logger.debug(f'Connected by: {addr}')
-
-                while True:
-                    time.sleep(INTERVAL)
-                    conn.sendall(data)
-
-    except KeyboardInterrupt:
-        logger.info("Received keyboard interrupt. Stopping.")
-        exit()
-    except Exception as e:
-        logger.warning(f"Exception occurred: {e}")
-
-        # just do 2 interrupt within a second to quit the program
-        time.sleep(1)
diff --git a/tangostationcontrol/tangostationcontrol/statistics_writer/udp_dev/__init__.py b/tangostationcontrol/tangostationcontrol/statistics_writer/udp_dev/__init__.py
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/tangostationcontrol/tangostationcontrol/test/statistics/test_writer.py b/tangostationcontrol/tangostationcontrol/test/statistics/test_writer.py
index 56d6d85e0d83c6b9ac1e35e981ade193ab90d317..9b73607fafa546aa0cc0db63c1569aebdff99114 100644
--- a/tangostationcontrol/tangostationcontrol/test/statistics/test_writer.py
+++ b/tangostationcontrol/tangostationcontrol/test/statistics/test_writer.py
@@ -7,13 +7,14 @@
 # Distributed under the terms of the APACHE license.
 # See LICENSE.txt for more info.
 
-from tangostationcontrol.test import base
-from tangostationcontrol.statistics import writer
 import sys
 from os.path import dirname, isfile
 from tempfile import TemporaryDirectory
 from unittest import mock
 
+from tangostationcontrol.test import base
+from tangostationcontrol.statistics.writer import entry
+
 
 class TestStatisticsWriter(base.TestCase):
 
@@ -21,20 +22,30 @@ class TestStatisticsWriter(base.TestCase):
 
     def test_xst(self):
         with TemporaryDirectory() as tmpdir:
-            new_sys_argv = [sys.argv[0], "--mode", "XST", "--file", dirname(__file__) + "/SDP_XST_statistics_packets.bin", "--output_dir", tmpdir]
-            with mock.patch.object(writer.sys, 'argv', new_sys_argv):
+            new_sys_argv = [
+                sys.argv[0],
+                "--mode", "XST",
+                "--file", dirname(__file__) + "/SDP_XST_statistics_packets.bin",
+                "--output_dir", tmpdir
+            ]
+            with mock.patch.object(entry.sys, 'argv', new_sys_argv):
                 with self.assertRaises(SystemExit):
-                    writer.main()
+                    entry.main()
 
             # check if file was written
             self.assertTrue(isfile(f"{tmpdir}/XST_SB102_2021-09-13-13-21-32.h5"))
 
     def test_xst_multiple_subbands(self):
         with TemporaryDirectory() as tmpdir:
-            new_sys_argv = [sys.argv[0], "--mode", "XST", "--file", dirname(__file__) + "/SDP_XST_statistics_packets_multiple_subbands.bin", "--output_dir", tmpdir]
-            with mock.patch.object(writer.sys, 'argv', new_sys_argv):
+            new_sys_argv = [
+                sys.argv[0],
+                "--mode", "XST",
+                "--file", dirname(__file__) + "/SDP_XST_statistics_packets_multiple_subbands.bin",
+                "--output_dir", tmpdir
+            ]
+            with mock.patch.object(entry.sys, 'argv', new_sys_argv):
                 with self.assertRaises(SystemExit):
-                    writer.main()
+                    entry.main()
 
             # check if files were written
             self.assertTrue(isfile(f"{tmpdir}/XST_SB102_2021-09-13-13-21-32.h5"))
@@ -42,10 +53,15 @@ class TestStatisticsWriter(base.TestCase):
 
     def test_bst(self):
         with TemporaryDirectory() as tmpdir:
-            new_sys_argv = [sys.argv[0], "--mode", "BST", "--file", dirname(__file__) + "/SDP_BST_statistics_packets.bin", "--output_dir", tmpdir]
-            with mock.patch.object(writer.sys, 'argv', new_sys_argv):
+            new_sys_argv = [
+                sys.argv[0],
+                "--mode", "BST",
+                "--file", dirname(__file__) + "/SDP_BST_statistics_packets.bin",
+                "--output_dir", tmpdir
+            ]
+            with mock.patch.object(entry.sys, 'argv', new_sys_argv):
                 with self.assertRaises(SystemExit):
-                    writer.main()
+                    entry.main()
 
             # check if file was written
             self.assertTrue(isfile(f"{tmpdir}/BST_2022-05-20-11-08-44.h5"))
diff --git a/tangostationcontrol/tox.ini b/tangostationcontrol/tox.ini
index 46de7e82971df8e253affc1f8c7b6f47cd409f9f..c87e4605816e3ea7ee22dfd9731d73c7912f85d8 100644
--- a/tangostationcontrol/tox.ini
+++ b/tangostationcontrol/tox.ini
@@ -30,9 +30,16 @@ commands = {envpython} -m stestr run {posargs}
 ; Warning running integration tests will make changes to your docker system!
 ; These tests should only be run by the integration-test docker container.
 passenv = TANGO_HOST
-setenv = TESTS_DIR=./tangostationcontrol/integration_test/{env:TEST_MODULE:default}
+setenv =
+    VIRTUAL_ENV={envdir}
+    TESTS_DIR=./tangostationcontrol/integration_test/{env:TEST_MODULE:default}
+    PYTHON={envpython} -m coverage run --source tangostationcontrol --parallel-mode
 commands =
     {envpython} -m stestr run --serial {posargs}
+    {envpython} -m coverage combine
+    {envpython} -m coverage html --omit='*test*' -d cover
+    {envpython} -m coverage xml -o coverage.xml
+    {envpython} -m coverage report --omit='*test*'
 
 [testenv:cover]
 ; stestr does not natively support generating coverage reports use