refining handshake and protocol