Added variable dvalue to smartest change of sampling