anchor.diff:          Keys::[{?RT:key(), OldExists::boolean()}], Note::string()) -> true.
   check_keys_in_deleted(DB, ChangesInterval, Keys, Note) ->
       {_ChangedEntries, DeletedKeys} = ?TEST_DB:get_changes(DB),
  -    [begin
  -         case intervals:in(Key, ChangesInterval) andalso OldExists of
  -             true ->
  -                 case length([K || K <- DeletedKeys, K =:= Key]) of
  -                     1 -> ok;
  -                     _ -> ?ct_fail("element(2, ?TEST_DB:get_changes(DB)) evaluated "
  -                                   "to \"~w\" and did not contain 1x key ~w~n(~s)~n",
  -                                   [DeletedKeys, Key, lists:flatten(Note)])
  -                 end;
  -             _    -> true
  -         end
  -     end || {Key, OldExists} <- Keys],
  -    true.
  +    [check_key_in_deleted_internal(DeletedKeys, ChangesInterval, Key, OldExists, Note)
  +    || {Key, OldExists} <- Keys],
  +    true.
  +
  +-spec check_key_in_deleted_internal(
  +        DeletedKeys::intervals:interval(), ChangesInterval::intervals:interval(),
  +        Key::?RT:key(), OldExists::boolean(), Note::string()) -> true.
  +check_key_in_deleted_internal(DeletedKeys, ChangesInterval, Key, OldExists, Note) ->
  +    case intervals:in(Key, ChangesInterval) andalso OldExists of
  +        true ->
  +            case length([K || K <- DeletedKeys, K =:= Key]) of
  +                1 -> ok;
  +                _ -> ?ct_fail("element(2, ?TEST_DB:get_changes(DB)) evaluated "
  +                              "to \"~w\" and did not contain 1x key ~w~n(~s)~n",
  +                              [DeletedKeys, Key, lists:flatten(Note)])
  +            end;
  +        _    -> true
  +    end.
   
   %% @doc Checks that an entry is present exactly once in the list of changed
   %%      entries returned by ?TEST_DB:get_changes/1.
  --spec check_entry_in_changes(
  +-spec check_entry_in_changed_entries(
           DB::?TEST_DB:db(), ChangesInterval::intervals:interval(), Entry::db_entry:entry(),
           {OldExists::boolean(), OldEntry::db_entry:entry()}, Note::string()) -> ok.
  -check_entry_in_changes(DB, ChangesInterval, NewEntry, {_OldExists, OldEntry}, Note) ->
  -    case intervals:in(db_entry:get_key(NewEntry), ChangesInterval) andalso 
  +check_entry_in_changed_entries(DB, ChangesInterval, NewEntry, {_OldExists, OldEntry}, Note) ->
  +    {ChangedEntries, _DeletedKeys} = ?TEST_DB:get_changes(DB),
  +    check_entry_in_changed_entries_internal(ChangedEntries, ChangesInterval, NewEntry, OldEntry, Note).
  +
  +-spec check_entry_in_changed_entries_internal(
  +        ChangedEntries::?TEST_DB:db_as_list(), ChangesInterval::intervals:interval(),
  +        NewEntry::db_entry:entry(), OldEntry::db_entry:entry(), Note::string()) -> ok.
  +check_entry_in_changed_entries_internal(ChangedEntries, ChangesInterval, NewEntry, OldEntry, Note) ->
  +    case intervals:in(db_entry:get_key(NewEntry), ChangesInterval) andalso
                OldEntry =/= NewEntry of
           true ->
  -            {ChangedEntries, _DeletedKeys} = ?TEST_DB:get_changes(DB),
               case length([E || E <- ChangedEntries, E =:= NewEntry]) of
                   1 -> ok;
                   _ -> ?ct_fail("~s evaluated to \"~w\" and did not contain 1x entry ~w~n(~s)~n",
  
positive.code:     ?equals_w_note(?TEST_DB:get_changes(DB9), {[], []}, "stop_record_changes_11"),
  
      ?TEST_DB:close(DB9),
      true.
  
  get_random_interval_from_changes(DB) ->
  
negative.code:                                 db_entry:inc_readlock(db_entry:new(2, "Value2", 2)),
                                  db_entry:new(3, "Value3", 2),
                                  db_entry:new(4, "Value4", 2),
                                  db_entry:new(5, "Value5", 2)]),
      prop_update_entry({239309376718523519117394992299371645018, empty_val, false, 0, -1},
                        <<6>>, false, 7, 4).
  
  changed_keys(_Config) ->
      DB = ?TEST_DB:new(),
  