added client handshake method