consolidated measure_b function