Fix the herp

Fixed bugs in format_packet() and decode_packet()
Added reentrancy
Added comprehensive test (test_runner.c and packet_test.c)
I feel like the best comment is a removal of the line.