anchor.diff:  filter([], _, Acc) ->
   	lists:reverse(Acc).
   
  +%% @hidden
  +query_auth(Start, End, Protocol, Types, ReqAttrs, ResAttrs, PageSize) ->
  +	query_auth(start, Start, End, Protocol, Types,
  +			ReqAttrs, ResAttrs, PageSize, 0, []).
  +%% @hidden
  +query_auth(Cont, Start, End, Protocol, Types,
  +		ReqAttrs, ResAttrs, PageSize, Count, Acc) ->
  +	case ocs_log:auth_query(Cont, Start, End,
  +			Protocol, Types, ReqAttrs, ResAttrs) of
  +		{error, Reason} ->
  +			{error, Reason};
  +		{Cont1, Events} ->
  +			{NewCount, NewAcc} = case length(Events) + Count of
  +				Total when Total =< PageSize ->
  +					{Total, [Events | Acc]};
  +				Total ->
  +					{Total, [lists:sublist(Events, PageSize - Count) | Acc]}
  +			end,
  +			case Cont1 of
  +				eof ->
  +					{NewCount, lists:flatten(lists:reverse(NewAcc))};
  +				_ when NewCount >= PageSize ->
  +					{NewCount, lists:flatten(lists:reverse(NewAcc))};
  +				_ ->
  +					query_auth(Cont1, Start, End, Protocol, Types,
  +							ReqAttrs, ResAttrs, PageSize, NewCount, NewAcc)
  +			end
  +	end.
  +
  +%% @hidden
  +query_acct(Start, End, Protocol, Types, Attrs, PageSize) ->
  +	query_acct(start, Start, End, Protocol, Types, Attrs, PageSize, 0, []).
  +%% @hidden
  +query_acct(Cont, Start, End, Protocol, Types, Attrs, PageSize, Count, Acc) ->
  +	case ocs_log:acct_query(Cont, Start, End, Protocol, Types, Attrs) of
  +		{error, Reason} ->
  +			{error, Reason};
  +		{Cont1, Events} ->
  +			{NewCount, NewAcc} = case length(Events) + Count of
  +				Total when Total =< PageSize ->
  +					{Total, [Events | Acc]};
  +				Total ->
  +					{Total, [lists:sublist(Events, PageSize - Count) | Acc]}
  +			end,
  +			case Cont1 of
  +				eof ->
  +					{NewCount, lists:flatten(lists:reverse(NewAcc))};
  +				_ when NewCount >= PageSize ->
  +					{NewCount, lists:flatten(lists:reverse(NewAcc))};
  +				_ ->
  +					query_acct(Cont1, Start, End, Protocol, Types,
  +							Attrs, PageSize, NewCount, NewAcc)
  +			end
  +	end.
  +
  
positive.code: 
  %% @hidden
  get_auth_query([] = _Query, Filters) ->
  	{ok, _MaxItems} = application:get_env(ocs, rest_page_size),
  	case ocs_log:auth_query(1, 1, '_', '_', '_', '_') of
  		[] ->
  			{error, 404};
  		Events ->
  			JsonObj = usage_aaa_auth(Events, Filters),
  			JsonArray = {array, JsonObj},
  			Body = mochijson:encode(JsonArray),
  			N = integer_to_list(length(Events)),
  			ContentRange = "items 1-" ++ N ++ "/" ++ N,
  			Headers = [{content_type, "application/json"},
  					{content_range, ContentRange}],
  
negative.code: %% 	`GET /usageManagement/v1/usage/{id}'
  %% 	requests.
  get_usage("auth-" ++ _ = Id, [] = _Query) ->
  	{ok, MaxItems} = application:get_env(ocs, rest_page_size),
  	["auth", TimeStamp, Serial] = string:tokens(Id, [$-]),
  	TS = list_to_integer(TimeStamp),
  	N = list_to_integer(Serial),
  	case query_auth(TS, TS, '_', '_', '_', '_', MaxItems) of
  		{error, _} ->
  			{error, 500};
  		{_, Events} ->
  			case lists:keyfind(N, 2, Events) of
  				Event when is_tuple(Event) ->
  					JsonObj = usage_aaa_auth(Event, []),
  					Body = mochijson:encode(JsonObj),
  					{_, Date} = lists:keyfind("date", 1, Attr),
  					Headers = [{content_type, "application/json"}, {last_modified, Date}],
  					{ok, Headers, Body};
  				_ ->
  					{error, 404}
  			end
  	end;
  get_usage("acct-" ++ _ = Id, [] = _Query) ->
  	{ok, MaxItems} = application:get_env(ocs, rest_page_size),
  	["acct", TimeStamp, Serial] = string:tokens(Id, [$-]),
  	TS = list_to_integer(TimeStamp),
  	N = list_to_integer(Serial),
  	case query_acct(TS, TS, '_', '_', '_', MaxItems) of
  		{error, _} ->
  			{error, 500};
  		{_, Events} ->
  			case lists:keyfind(N, 2, Events) of
  				Event when is_tuple(Event) ->
  					JsonObj = usage_aaa_acct(Event, []),
  					Body = mochijson:encode(JsonObj),
  					{_, Date} = lists:keyfind("date", 1, Attr),
  					Headers = [{content_type, "application/json"}, {last_modified, Date}],
  					{ok, Headers, Body};
  				_ ->
  					{error, 404}
  			end
  	end;
  get_usage(Id, [] = _Query) ->
  	{ok, MaxItems} = application:get_env(ocs, rest_page_size),
  