Initial handling of handshake