Some minor tweaks
Fix a bug in split packet(packet index was 65535, so out of range in array)
Added some comments