added BMD and BMDmarg functions