many additions to wire-protocol implementation