anchor.diff:  populate_token_channel_data([Token|Tail]) when is_record(Token, token) ->
       case logplex_channel:lookup(Token#token.channel_id) of
           undefined ->
  -            io:format("Error ~p ~p ~p ~p~n", [?MODULE, populate_token_channel_data, undefined_channel, Token]);
  +            ?ERR("~p ~p ~p~n",
  +                 [populate_token_channel_data, undefined_channel, Token]);
           #channel{app_id=AppId} ->
               ets:insert(tokens, Token#token{app_id=AppId})
       end,
  
positive.code: handle({cmd, "hmset", [<<"ch:", Rest/binary>> | Args]}) ->
      Id = list_to_integer(parse_id(Rest)),
      Dict = dict_from_list(Args),
      io:format("[~p] event=set type=channel id=~p~n", [?MODULE, Id]),
      create_channel(Id, Dict);
  
  handle({cmd, "hmset", [<<"tok:", Rest/binary>> | Args]}) ->
      Id = list_to_binary(parse_id(Rest)),
      Dict = dict_from_list(Args),
      Token = create_token(Id, Dict),
      io:format("[~p] event=set type=token id=~p~n", [?MODULE, Id]),
      populate_token_channel_data([Token]);
  
  handle({cmd, "hmset", [<<"drain:", Rest/binary>> | Args]}) ->
      Id = list_to_integer(parse_id(Rest)),
      Dict = dict_from_list(Args),
      Drain = create_drain(Id, Dict),
      io:format("[~p] event=set type=drain id=~p~n", [?MODULE, Id]),
      Drain#drain.host =/= undefined andalso populate_token_drain_data([Drain]);
  
  handle({cmd, "del", [<<"ch:", Rest/binary>> | _Args]}) ->
      Id = list_to_integer(parse_id(Rest)),
      io:format("[~p] event=delete type=channel id=~p~n", [?MODULE, Id]),
      ets:delete(channels, Id);
  
  handle({cmd, "del", [<<"tok:", Rest/binary>> | _Args]}) ->
      Id = list_to_binary(parse_id(Rest)),
      io:format("[~p] event=delete type=token id=~p~n", [?MODULE, Id]),
      ets:delete(tokens, Id);
  
  handle({cmd, "del", [<<"drain:", Rest/binary>> | _Args]}) ->
      Id = list_to_integer(parse_id(Rest)),
      io:format("[~p] event=delete type=drain id=~p~n", [?MODULE, Id]),
      remove_token_drain_data(Id),
      ets:delete(drains, Id);
  
  
negative.code: create_drain(Id, Dict) ->
      case dict_find(<<"ch">>, Dict) of
          undefined ->
              ?ERR("~p ~p ~p ~p~n",
                   [create_drain, missing_ch, Id, dict:to_list(Dict)]);
          Val1 ->
              Ch = list_to_integer(binary_to_list(Val1)),
              case dict_find(<<"token">>, Dict) of
                  undefined ->
                      ?ERR("~p ~p ~p ~p~n",
                           [create_drain, missing_token, Id, dict:to_list(Dict)]);
                  Token ->
                      Host = dict_find(<<"host">>, Dict),
                      Port =
  