anchor.diff:          write_scrubbed_to_db(?TEST_DB:new(randoms:getRandomString()), Data),
       ExpInInterval = [El || El <- ScrubbedData,
                              is_in(Interval, element(1, El))],
  -    ExpInIntervalCounted = lists:sublist(lists:reverse(lists:keysort(1, ExpInInterval)), MaxNum),
  +    ExpInIntervalCounted = case MaxNum >= length(ExpInInterval) of
  +                               true ->
  +                                   ExpInInterval;
  +                               _ ->
  +                                   lists:nthtail(length(ExpInInterval) - MaxNum, ExpInInterval)
  +                           end,
       AllFold = ?TEST_DB:foldr(DB1, fun(E, AccIn) -> [E | AccIn] end, []),
       IntervalFold = ?TEST_DB:foldr(DB1,
                                    fun(E, AccIn) -> [E | AccIn] end,
  
positive.code:                             [],
                              Interval,
                              MaxNum),
      ?equals_w_note(lists:sort(ScrubbedData), lists:sort(AllFold), "test_foldl1"),
      ?equals_w_note(lists:sort(ExpInInterval), lists:sort(IntervalFold), "test_foldl2"),
      ?equals_w_note(lists:sort(ExpInIntervalCounted),
                     lists:sort(IntervalCountFold), "test_foldl3"),
      ?TEST_DB:close(DB1),
      true.
  
  
negative.code:         write_scrubbed_to_db(?TEST_DB:new(randoms:getRandomString()), Data),
      ExpInInterval = [El || El <- ScrubbedData,
                             is_in(Interval, element(1, El))],
      ExpInIntervalCounted = lists:sublist(ExpInInterval, MaxNum),
      AllFold = ?TEST_DB:foldl(DB1, fun(E, AccIn) -> [E | AccIn] end, []),
      IntervalFold = ?TEST_DB:foldl(DB1,
                                   fun(E, AccIn) -> [E | AccIn] end,
  