new class to handle packets
more tests and fixes