Added handshake procedure.