anchor.diff:  		Charge :: integer(),
   		Final :: boolean(),
   		Buckets :: [#bucket{}],
  -		Result :: {Charged, Buckets},
  +		Result :: {RemainCharge, Charged, Buckets},
  +		RemainCharge :: integer(),
   		Charged :: integer().
   charge(Type, Charge, Final, Buckets) ->
   	Now = erlang:system_time(?MILLISECOND),
  
positive.code: 		remain_amount = R}  = B | T], Acc, Charged) when R =< Charge ->
  	charge(Type, Charge - R, Now, false, T, [B | Acc], Charged);
  charge(_Type, 0, _Now, _Final, Buckets, Acc, Charged) ->
  	{Charged, Buckets ++ Acc};
  charge(Type, Charge, Now, Final, [H | T], Acc, Charged) ->
  	charge(Type, Charge, Now, Final, T, [H | Acc], Charged);
  charge(_Type, _Charge, _Now, _Final, [], Acc, Charged) ->
  	{Charged, Acc}.
  
  -spec purchase(Type, Price, Size, Used, Validity, Final, Buckets) -> Result
  	when
  
negative.code: 		#price{units = Type, size = Size, amount = Price} = lists:keyfind(usage, #price.type, Prices),
  		{Type, Reserve} = lists:keyfind(Type, 1, ReserveAmount),
  		case charge(Type, Reserve, false, Buckets) of
  			{R1, C1, NB1} when R1 < 0 ->
  				{C2, NB2} = purchase(Type, Price, Size, Reserve - C1, Validity, false, NB1),
  				{R1, NB2, Reserve};
  			{R1, C1, NB1} ->
  				{R1, NB1, Reserve}
  		end
  	of
  		{RemainCharge, NewBuckets, Amount} ->
  			rate3(Subscriber#subscriber{buckets = NewBuckets},
  					RemainCharge, Flag, Amount, SessionIdentification)
  	catch
  		_:_ ->
  			throw(price_not_found)
  