Restructed comms packet handling code; added binary log packet type and associated procedures and tests