cleaning up calc_bstar function