added support for packet sending
switched the decoder to a codec, and added a packet encoder
added/removed comments