refactored to use bindata for packet decoding