anchor.diff:  
   
   %% @doc
  -%% Picks a matching filter with highest QoS.
  +%% Picks the lowest matching filter with highest QoS, then closest filter.
   %% @end
   best_match(Subs,Topic) ->
  -    Matches = lists:filter(fun({Filter,_}) -> is_covered_by(Topic,Filter) end, Subs),
  -    case lists:sort(fun({_,QoS1},{_,QoS2}) -> QoS1 >= QoS2 end, Matches) of
  -        [H|_] -> {ok,H};
  -        []    -> error
  +    Matches = [ Sub || {Filter,_} = Sub <- Subs, is_covered_by(Topic,Filter)],
  +    case Matches of
  +        [] -> error;
  +        [H|T] ->
  +            BestMatch =
  +                lists:foldl(
  +                    fun(El = {Filter,QoS},Acc = {AccFilter,AccQoS}) ->
  +                        case QoS > AccQoS orelse QoS =:= AccQoS andalso is_covered_by(Filter,AccFilter) of
  +                            true -> El;
  +                            false -> Acc
  +                        end
  +                    end,
  +                    H,T),
  +            {ok,BestMatch}
       end.
   
   %% normalize(<<Pattern/binary>>) ->
  
positive.code:     T.
  
  is_covered_by({Pattern1,QoS1},{Pattern2,QoS2}) ->
      is_covered_by(Pattern1,Pattern2) andalso QoS2 >= QoS1;
  
  %% @doc
  %% Tells us if the Cover covers the Pattern.
  
negative.code: seg_is_covered_by([],[_|_])     -> false; %% else if the pattern is longer than the potential match, there is no match
  seg_is_covered_by([_|_],[])     -> false; %% else if the patter is shorter than the potential match
  seg_is_covered_by([],[])        -> true;  %% if the pattern is as long as the potential match, THIS IS a match
  
  
  %% # > + > char
  seg_is_covered_by([PH|PT],[CH|CT])->
  