anchor.diff:  	end.
   
   %% Return: {take_many,number of matches,list of entries - could be empty}
  -take_many(State,Type_name, Template, Limit) ->
  -	case lists:keysearch(Type_name, 1,State#state.type_structures) of
  +take_many(State,Type, Template, Limit) ->
  +	case lists:keysearch(Type, 1,State#state.type_structures) of
   		false -> {fail, missing_type};
   		{value,{_,Type_channel,_,Field_info}} ->
   			Template_entry = create_Zn_entry(Template),
  
positive.code: 	{ping, get_tags(Response,[])}.
  
  %% Return: {read,number of matches: 1 or 0,Entry or any empty tuple}
  read(_State,_Type_name, _Template, {Time_left,_Repeat_time}) when Time_left < 0 ->
  	{read,0,{}};
  read(State,Type_name, Template, {Time_left,Repeat_time}) ->
  	case read(State,Type_name, Template) of
  		{read,0,{}} -> pause(Repeat_time),
  					   read(State,Type_name, Template,{Time_left-Repeat_time,Repeat_time});
  		Else-> Else
  	end;
  read(State,Type_name, Template, Time_left) ->
  	read(State,Type_name, Template, {Time_left,Time_left}).
  					   
  read(State,Type_name, Template) ->
  	case lists:keysearch(Type_name, 1,State#state.type_structures) of
  		false -> {fail, missing_type};
  		{value,{_,Type_channel,_,Field_info}} ->
  			Template_entry = create_Zn_entry(Template),
  			Header = <<16#FAB20001:?ZnInt>>,
  			Binary = <<Header/binary,Type_channel:?ZnInt, Template_entry/binary,0:?ZnLong>>,
  			parse_single_entry_responses(read,State#state.socket,Field_info,Binary)
  	end.
  
  %% Return: {take,number of matches: 1 or 0,Entry or any empty tuple}
  take(_State,_Type_name, _Template, {Time_left,_Repeat_time}) when Time_left < 0 ->
  	{take,0,{}};
  take(State,Type_name, Template, {Time_left,Repeat_time}) ->
  	case take(State,Type_name, Template) of
  		{take,0,{}} -> pause(Repeat_time),
  					   take(State,Type_name, Template,{Time_left-Repeat_time,Repeat_time});
  		Else-> Else
  	end;
  take(State,Type_name, Template, Time_left) ->
  	take(State,Type_name, Template, {Time_left,Time_left}).
  
  take(State,Type_name, Template) ->
  	case lists:keysearch(Type_name, 1,State#state.type_structures) of
  		false -> {fail, missing_type};
  		{value,{_,Type_channel,_,Field_info}} ->
  			Template_entry = create_Zn_entry(Template),
  			Header = <<16#FAB20002:?ZnInt>>,
  			Binary = <<Header/binary,Type_channel:?ZnInt, Template_entry/binary,0:?ZnLong>>,
  			parse_single_entry_responses(take,State#state.socket,Field_info, Binary)
  	end.
  
  parse_single_entry_responses(Type,Sock,Field_info,Request_binary) ->
  	ok = gen_tcp:send(Sock, Request_binary),
  	{ok,<<Num_fields:?ZnLong>>} = gen_tcp:recv(Sock,8),
  	
  	case Num_fields of
  		0 -> {Type,0, {}};
  		_ -> {ok,<<_UUID:?ZnUUID,Binary/binary>>} = gen_tcp:recv(Sock,0),
  
negative.code: 	timer:sleep(Wait).
  
  %% Return: {write,Lease time in ms}
  write(State,Type, Template, Lease) ->
  	case lists:keysearch(Type, 1,State#state.type_structures) of
  		false -> {fail, missing_type};
  		{value,{_,Type_channel,_,_}} ->
  			ID_entry = create_id_object(create_Zn_entry(Template)),
  			Header = <<16#FAB20003:?ZnInt>>,
  			Timeout = 1000,
  		    ok = gen_tcp:send(State#state.socket, <<Header/binary,Type_channel:?ZnInt, ID_entry/binary,Lease:?ZnLong>>),
  			{ok,<<Lease_granted:?ZnLong>>} = gen_tcp:recv(State#state.socket,0,Timeout),
  			{write,Lease_granted}
  	end.
  
  %% Return: {read_many,number of matches,list of entries - could be empty}
  read_many(State,Type, Template, Limit) ->
  	case lists:keysearch(Type, 1,State#state.type_structures) of
  		false -> {fail, missing_type};
  		{value,{_,Type_channel,_,Field_info}} ->
  			Template_entry = create_Zn_entry(Template),
  