NEW: small function to calculate bvalue