anchor.diff:  	nrf2(M, [{"invocationTimeStamp", TS} | Acc]).
   nrf2(#{"invocationSequenceNumber" := SeqNum} = M, Acc) ->
   	nrf3(M, [{"invocationSequenceNumber", SeqNum} | Acc]).
  -nrf3(#{"msisdn" := MSISDN, "imsi" := IMSI} = M, Acc) ->
  -	nrf4(M, [{"subscriptionId", {array, ["msisdn-" ++ MSISDN,
  -			"imsi-" ++ IMSI]}} | Acc]).
  +nrf3(#{"subscriptionId" := SubIds} = M, Acc) ->
  +	nrf4(M, [{"subscriptionId", {array, subscriptionId_list(SubIds)}} | Acc]).
   nrf4(#{"nodeFunctionality" := NF} = M, Acc) ->
   	nrf5(M, [{"nfConsumerIdentification",
   			{struct, [{"nodeFunctionality", NF}]}} | Acc]).
  
positive.code: 		Reason :: term().
  %% @doc Add a rating data ref to the rating ref table.
  add_rating_ref(RatingDataRef, #{"nodeFunctionality" := NF,
  		"imsi" := IMSI, "msisdn" := MSISDN} = _NrfMap) ->
  	F = fun() ->
  			NewRef = #nrf_ref{rating_ref = RatingDataRef,
  					 nodeFunctionality = NF, imsi = IMSI, msisdn = MSISDN},
  			mnesia:write(nrf_ref, NewRef, write)
  	end,
  	case mnesia:transaction(F) of
  
negative.code: 	ServiceType = service_type(list_to_binary(SCI)),
  	TS = calendar:universal_time(),
  	case ocs_rating:rate(diameter, ServiceType, ServiceId, ChargingKey,
  			MCCMNC, get_subscriber(SubscriptionIds), TS, undefined, undefined, Flag,
  			Debits, Reserves, [{"invocationSequenceNumber", ISN}]) of
  		{ok, _, {Type, Amount} = _GrantedAmount} when Amount > 0 ->
  			RatedMap = Map4#{"resultCode" => "SUCCESS", "grantedUnit" => #{type(Type) => Amount},
  					"serviceContextId"=> SCI},
  			rate(T, ISN, SubscriptionIds, Flag, [RatedMap | Acc]);
  		{ok, _, {_, 0} = _GrantedAmount} ->
  			RatedMap = Map4#{"resultCode" => "SUCCESS", "serviceContextId" => SCI},
  			rate(T, ISN, SubscriptionIds, Flag, [RatedMap | Acc]);
  		{ok, _, {Type, Amount}, _} ->
  			RatedMap = Map4#{"resultCode" => "SUCCESS", "grantedUnit" => #{type(Type) => Amount},
  					"serviceContextId"=> SCI},
  			rate(T, ISN, SubscriptionIds, Flag, [RatedMap | Acc]);
  		{ok, _, _} ->
  			RatedMap = Map4#{"resultCode" => "SUCCESS", "serviceContextId" => SCI},
  			rate(T, ISN, SubscriptionIds, Flag, [RatedMap | Acc]);
  		{out_of_credit, _, _} ->
  			RatedMap = Map4#{"resultCode" => "QUOTA_LIMIT_REACHED",
  					"serviceContextId" => SCI},
  			rate(T, ISN, SubscriptionIds, Flag, [RatedMap | Acc]);
  		{error, Reason} ->
  			{error, Reason}
  	end;
  rate([], _ISN, _Subscriber, _Flag, Acc) ->
  	F = fun F([#{"resultCode" := "SUCCESS"} | _T]) ->
  			Acc;
  