tested bb, still need to figure out why optimal_loc_d isn't right