Better receiving, can handle multiple packets

Fixed a bug where multiple packets being received in one buffer would
mess up the parsing. Thanks 0xDEADDEAD