WH algorithm v3