Added tests, implemented createpacket()