Update to handshake message.

Structural changes and bug fixes.