stuff about best sample and MAP