anchor.diff:  	NewContainer = F(H, Container, []),
   	build_mscc(T, NewContainer);
   build_mscc([], Container) ->
  -	lists:reverse(Container).
  +	Container.
   
   -spec map_service_rating(ServiceRating, SessionId) -> Result
   	when
  
positive.code: 				calendar:universal_time()
  		end,
  		Amounts = get_mscc(MSCC1),
  		RfResponse = case rate(ServiceType, ServiceNetwork, Subscribers, Timestamp,
  				Address, Direction, interim, SessionId, Amounts) of
  			{{MSCC2, ResultCode}, [], []} ->
  				{ok, MSCC2, ResultCode};
  			{{MSCC2, _ResultCode}, PLA, Amounts1} ->
  				{ok, get_ref(SessionId), PLA, Amounts1, MSCC2};
  			{error, Reason} ->
  				{error, Reason}
  		end,
  		case RfResponse of
  			{ok, ServiceRating, PLA1, Amounts2, MSCC3} ->
  				case charge(Subscribers, ServiceRating, Amounts2, SessionId, interim) of
  					{ok, NewMSCC1, ResultCode1} ->
  						Container = build_container(MSCC1),
  						NewMSCC3 = build_mscc(NewMSCC1 ++ MSCC3, Container),
  
negative.code: 			{error, Reason}
  	end;
  rate(_, _, _, _, _, _, _, _, [], [], [], [], undefined, undefined) ->
  	{{[], ?'DIAMETER_CC_APP_RESULT-CODE_RATING_FAILED', undefined}, []};
  rate(_, _, _, _, _, _, _, _, [], Acc1, Acc2, Acc3, ResultCode, undefined) ->
  	{{lists:reverse(Acc1), ResultCode, undefined}, lists:reverse(Acc2), lists:reverse(Acc3)};
  rate(_, _, _, _, _, _, _, _, [], Acc1, Acc2, Acc3, ResultCode, Rated) ->
  	{{lists:reverse(Acc1), ResultCode, Rated}, lists:reverse(Acc2), lists:reverse(Acc3)}.
  
  -spec match_tariff(Tariffs, MSCCs) -> Result
  	when
  		Tariffs:: [map()],
  		MSCCs :: [{ServiceIdentifier, RatingGroup,
  				UsedAmounts, ReserveAmounts}],
  		ServiceIdentifier :: [pos_integer()],
  		RatingGroup :: [pos_integer()],
  		UsedAmounts :: [{Units, pos_integer()}],
  		ReserveAmounts :: [{Units, pos_integer()}],
  		Units :: octets | seconds | messages,
  		Result :: Prices | {error, missing_tariff},
  		Prices :: [Price],
  		Price :: map().
  %% @doc Match a Tariff object with an MSCC
  match_tariff(Tariffs, MSCCs) ->
  	match_tariff(Tariffs, MSCCs, []).
  %% @hidden
  match_tariff(Tariffs, [H | T], Acc) ->
  	F = fun F([#{"tariffElement" := #{"currencyCode" := Currency,
  					"rateElements" := #{"unitType" := Units,
  					"unitSize" := UnitSize, "unitCost" := UnitPrice}},
  					"ratingGroup" := RG1, "serviceId" := SI1} | _],
  					{[SI], [RG], Debits, Reserves})
  						when RG1 =:= RG, SI1 =:= SI ->
  					#{"rg" => RG1, "si" => SI1, "currency" => Currency,
  							"units" => Units, "unitSize" => UnitSize,
  							"unitPrice" => UnitPrice, "debits" => Debits,
  							"reserves" => Reserves};
  			F([#{"tariffElement" := #{"currencyCode" := Currency,
  					"rateElements" := #{"unitType" := Units,
  					"unitSize" := UnitSize, "unitCost" := UnitPrice}},
  					"serviceId" := SI1} | _],
  					{[SI], [], Debits, Reserves})
  						when SI1 =:= SI ->
  					#{"rg" => undefined, "si" => SI1, "currency" => Currency,
  							"units" => Units, "unitSize" => UnitSize,
  							"unitPrice" => UnitPrice, "debits" => Debits,
  							"reserves" => Reserves};
  			F([#{"tariffElement" := #{"currencyCode" := Currency,
  					"rateElements" := #{"unitType" := Units,
  					"unitSize" := UnitSize, "unitCost" := UnitPrice}},
  					"ratingGroup" := RG1} | _],
  					{[], [RG], Debits, Reserves})
  						when RG1 =:= RG ->
  					#{"rg" => RG1, "si" => undefined, "currency" => Currency,
  							"units" => Units, "unitSize" => UnitSize,
  							"unitPrice" => UnitPrice, "debits" => Debits,
  							"reserves" => Reserves};
  			F([H1 | T1], MSCC) ->
  erlang:display({?MODULE, ?LINE, H1}),
  erlang:display({?MODULE, ?LINE, MSCC}),
  				F(T1, MSCC);
  			F([], _MSCC) ->
  				{error, missing_tariff}
  	end,
  	case F(Tariffs, H) of
  				#{} = Charge ->
  					match_tariff(Tariffs, T, [Charge | Acc]);
  				{error, missing_tariff} ->
  					{error, missing_tariff}
  	end;
  match_tariff(_Tariffs, [], Acc) ->
  	lists:reverse(Acc).
  
  -spec charge(Subscribers, SessionId, Flag, Prices) -> Result
  	when
  		Subscribers :: [Subscriber],
  		Subscriber :: {IdType, Id},
  		IdType :: 0..4,
  		Id :: binary(),
  		SessionId :: binary(),
  		Flag :: initial | interim | final | event,
  		Prices :: [Price],
  		Price :: map(),
  		Result :: {ok, MSCCs, ResultCode}
  				| {error, Reason},
  		ResultCode :: pos_integer(),
  