anchor.diff:          terminate/2,
   		code_change/3]).
   
  +%%----------------------------------------------------------------------------
  +
  +-ifdef(use_specs).
  +
  +-spec topics() -> list(topic()).
  +
  +-spec subscribe({binary(), mqtt_qos()} | list(), pid()) -> {ok, list(mqtt_qos())}.
  +
  +-spec unsubscribe(binary() | list(binary()), pid()) -> ok.
  +
  +-endif.
  +
  +%%----------------------------------------------------------------------------
  +
   -record(state, {}).
   
   %% ------------------------------------------------------------------
  
positive.code: 	[TrieNode=#topic_trie_node{topic=undefined}] ->
  		mnesia:write(TrieNode#topic_trie_node{topic=Topic});
  	[#topic_trie_node{topic=Topic}] ->
  		ignore;
  	[] ->
  		%add trie path
  		[trie_add_path(Triple) || Triple <- emqtt_topic:triples(Topic)],
  
negative.code: 	ets:new(topic_subscriber, [bag, named_table, {keypos, 2}]),
  	{ok, #state{}}.
  
  handle_call({subscribe, Topics, SubPid}, _From, State) ->
      Result = [subscribe_topic({Topic, Qos}, SubPid) || {Topic, Qos} <- Topics],
      Reply = 
      case [Err || Err = {error, _} <- Result] of
          [] -> {ok, [Qos || {ok, Qos} <- Result]};
          Errors -> hd(Errors)
      end,
      {reply, Reply, State};
  
  handle_call(Req, _From, State) ->
  	{stop, {badreq, Req}, State}.
  
  handle_cast({unsubscribe, Topics, SubPid}, State) ->
      lists:foreach(fun(Topic) -> 
          ets:match_delete(topic_subscriber, #topic_subscriber{topic=Topic, qos ='_', subpid=SubPid}),
          try_remove_topic(Topic)
      end, Topics),
  	{noreply, State};
  
  handle_cast(Msg, State) ->
  