New handshake logic