added handshake protocol