anchor.diff:                  {end_tag, "head"},
                   {start_tag, "body", [], false}],
       {"html", [], [{"head", [], []}, {"body", [], []}]} = parse_tokens(D3),
  +    D4 = D3 ++ [{data,"\n",true},
  +                {start_tag,"div",[{"class","a"}],false},
  +                {start_tag,"a",[{"name","#anchor"}],false},
  +                {end_tag,"a"},
  +                {end_tag, "div"},
  +                {start_tag,"div",[{"class","b"}],false},
  +                {start_tag,"div",[{"class","c"}],false},
  +                {end_tag, "div"},
  +                {end_tag, "div"}],
  +    {"html", [],
  +     [{"head", [], []},
  +      {"body", [],
  +       [{"div", [{"class", "a"}], [{"a", [{"name", "#anchor"}], []}]},
  +        {"div", [{"class", "b"}], [{"div", [{"class", "c"}], []}]}
  +       ]}]} = parse_tokens(D4),
       ok.
   
   tree([], Stack) ->
       {destack(Stack), []};
   tree([{end_tag, Tag} | Rest], Stack) ->
  -    tree(Rest, destack(norm(Tag), Stack));
  +    case destack(norm(Tag), Stack) of
  +        S when is_list(S) ->
  +            tree(Rest, S);
  +        Result ->
  +            {Result, []}
  +    end;
   tree([{start_tag, Tag, Attrs, true} | Rest], [T0 | S0]) ->
  -    tree(Rest, [destack([norm({Tag, Attrs}), T0]) | S0]);
  +    tree(Rest, stack(norm({Tag, Attrs}), T0, S0));
   tree([{start_tag, Tag, Attrs, false} | Rest], S) ->
       tree(Rest, [norm({Tag, Attrs}) | S]);
   tree([{data, Data, Whitespace} | Rest], [{Tag, Attrs, Acc} | S0]) ->
  
positive.code:         end,
      case lists:splitwith(F, Stack) of
          {_, []} ->
              Stack;
          {Pre, [T]} ->
              [destack(Pre ++ [T])];
          {Pre, [T, N | Post]} ->
              [destack(Pre ++ [T, N]) | Post]
      end.
              
  destack([Tag]) ->
      Tag;
  destack([Sub, {Tag, Attrs, Acc} | Rest]) ->
      destack([{Tag, Attrs, lists:reverse([Sub | Acc])} | Rest]).
  
  is_singleton("br") -> true;
  is_singleton("hr") -> true;
  
negative.code:         destack("c", [{"c", [], []}, {"b", [], []}, {"a", [], []}]),
      ok.
  
  stack(StartTag, {Name, Attrs, Acc}, Stack) ->
      [{Name, Attrs, [StartTag | Acc]} | Stack].
  
  destack(TagName, Stack) when is_list(Stack) ->
      F = fun (X) ->
                  case X of 
  