Made huge changes in packet encoding Snapshot #2

Please see logbook for explanation.