def improve_humidity_measurement(raw_humidity, dig_h, t_fine):
    """Refine the humidity measurement.

    Adapts the humidity measurement by using the available temperature
    information, along with the humidity readout details.

    Args:
        raw_humidity (int): raw humidity
        dig_h (list): raw data blocks pertaining to humidity measurement
        t_fine (float): temperature measurement

    Returns:
        float: refined humidity measurement

    Reference:
    Bosch data sheet, Appendix A, "BME280_compensate_H_double"
    """
    base_value = t_fine - 76800.0
    term1 = raw_humidity - (dig_h[3] * 64.0 + dig_h[4] / 16384.0 * base_value)
    term2a = base_value * (1.0 + dig_h[2] / 67108864.0 * base_value)
    term2 = dig_h[1] / 65536.0 * (1.0 + dig_h[5] / 67108864.0 * term2a)
    humidity = term1 * term2
    humidity = humidity * (1.0 - dig_h[0] * humidity / 524288.0)
    humidity = max(0, min(humidity, 100))
    return humidity