anchor.diff:  			{error, Reason}
   	end.
   %% @hidden
  -reserve_units1(?initial, Product, UnitType, Flag, RequestAmount, _Used, Validity, Buckets) ->
  -	case determinate_units(Product, UnitType, Flag, RequestAmount, Validity, Buckets) of
  +reserve_units1(?initial, Product, UnitType, Flag, ReserveAmount, _DebitAmount, Validity, Buckets) ->
  +	case determinate_units(Product, UnitType, Flag, ReserveAmount, Validity, Buckets) of
   		{Charged, _NewBuckets} when Charged =< 0 ->
   			out_of_credit;
   		{_Chraged, _NewBuckets} ->
  -			{grant, RequestAmount}	
  -	end.
  -reserve_units1(_, Product, Subscriber, UnitType, Flag, RequestAmount, Used, Validity, Buckets) ->
  -	case determinate_units(Product, UnitType, Flag, Used, Validity, Buckets) of
  -		{Charged, NewBuckets} when Charged =< 0 andalso Used =/= 0 ->
  +			{grant, ReserveAmount}
  +	end.
  +reserve_units1(_, Product, Subscriber, UnitType, Flag, ReserveAmount, DebitAmount, Validity, Buckets) ->
  +	case determinate_units(Product, UnitType, Flag, DebitAmount, Validity, Buckets) of
  +		{Charged, NewBuckets} when Charged =< 0 andalso DebitAmount =/= 0 ->
   			mnesia:write(Subscriber#subscriber{buckets = NewBuckets}),
   			out_of_credit;
   		{_Charged, NewBuckets} ->	
   			mnesia:write(Subscriber#subscriber{buckets = NewBuckets}),
  -			case determinate_units(Product, UnitType, Flag, RequestAmount, Validity, Buckets) of
  -				{Ch1, _NB1} when Ch1 =< 0 andalso RequestAmount =/=0  ->
  +			case determinate_units(Product, UnitType, Flag, ReserveAmount, Validity, Buckets) of
  +				{Ch1, _NB1} when Ch1 =< 0 andalso ReserveAmount =/=0  ->
   					out_of_credit;
   				_ ->
  -					{grant, RequestAmount}
  +					{grant, ReserveAmount}
   			end
   	end.
   %% @hidden
  -determinate_units([#product{price = Prices}], Type, Flag, Used, Validity, Buckets) ->
  -	case charge(Type, Used, Flag, Buckets) of
  -		{Charged, NewBuckets} when Charged < Used ->
  -			PriceType = case Type of
  -				octets -> usage;
  -				seconds -> seconds
  -			end,
  -			case lists:keyfind(PriceType, #price.type, Prices) of
  +determinate_units([#product{price = Prices}], Type, Flag, DebitAmount, Validity, Buckets) ->
  +	case charge(Type, DebitAmount, Flag, Buckets) of
  +		{Charged, NewBuckets} when Charged < DebitAmount ->
  +			case lists:keyfind(Type, #price.type, Prices) of
   				#price{size = Size, amount = Price} ->
  -					purchase(Type, Price, Size, Used - Charged, Validity, false, NewBuckets);
  +					purchase(Type, Price, Size, DebitAmount - Charged, Validity, false, NewBuckets);
   				false ->
   					throw(price_not_found)
   			end;
  
positive.code: 					Validity = proplists:get_value(validity, Chars),
  					case RequestType of
  						?initial ->
  							SA = case update_session(SessionId, SessionIdentification, SessionAttributes, []) of
  								SessionAttributes ->
  									SessionAttributes;
  								NewSessionAttributes ->
  									NewSessionAttributes
  							end,
  							case reserve_units1(?initial, Product, UnitType,
  									false, RequestAmount, MonitoryAmount, Validity, Buckets) of
  								out_of_credit ->
  									mnesia:write(Subscriber#subscriber{session_attributes = []}),
  									{out_of_credit, SA};
  
negative.code: 							end;
  						_ ->
  							case reserve_units1(RequestType, Product, Subscriber,
  									UnitType, true, ReserveAmount, DebitAmount, Validity, Buckets) of
  								out_of_credit ->
  									mnesia:write(Subscriber#subscriber{session_attributes = []}),
  									{out_of_credit, SessionAttributes};
  