It should be `current_threshold = Xf[p - 1]`.