anchor.diff:                  curLevel.Add result   
               result
   
  -        let containsEdge (b : Vertex) (e : Vertex) (ast : obj)=
  +        let containsEdge (b : Vertex) (e : Vertex) (ast : obj) =
               let edges = b.OutEdges
  -            let mutable result = false
  -            if edges.first <> Unchecked.defaultof<_>
  -            then
  -                if Vertex.Equal edges.first.Dest e && ast.Equals edges.first.Ast
  -                then result <- true
  -                elif edges.other <> null
  -                then result <- edges.other |> Array.exists (fun edge -> Vertex.Equal edge.Dest e && ast.Equals edge.Ast)
  -            result
  -
  -        let findTree prod extension family =
  -            let result = ref None
  -            let currentNonTerm = parser.LeftSide.[prod]
  -            let mutable wasAdded = false
  -            for pair in setP do
  -                match snd pair with
  -                | :? AST as a -> 
  -                    if parser.LeftSide.[a.first.prod] = currentNonTerm && a.extension = extension
  +            edges.first <> Unchecked.defaultof<_>
  +            && ( Vertex.Equal edges.first.Dest e && ast.Equals edges.first.Ast 
  +                 || (edges.other <> null && edges.other |> Array.exists (fun edge -> Vertex.Equal edge.Dest e && ast.Equals edge.Ast)))
  +
  +        let findTree prod extension family =            
  +            let currentNonTerm = parser.LeftSide.[prod]            
  +            let result =
  +                setP
  +                |> ResizeArray.tryFind
  +                    (fun pair ->     
  +                        match pair.Ast with
  +                        | :? AST as a -> parser.LeftSide.[a.first.prod] = currentNonTerm && a.extension = extension                
  +                        | _ -> failwith "Unexpected type of tree.")            
  +                |> Option.map
  +                 (fun p ->
  +                    let a = p.Ast :?> AST
  +                    if not <| (a.first.Equals family || (a.other <> null && a.other |> Array.exists(family.Equals)))
                       then
  -                        wasAdded <- a.first.Equals family || (a.other <> null && a.other |> Array.exists(family.Equals))                        
  -                        if not wasAdded
  -                        then
  -                            if a.other <> null
  -                            then a.other <- Array.append a.other [|family|]
  -                            else a.other <- [|family|]
  -                        result := Some a
  -                | _ -> failwith "Unexpected type of tree."
  +                        if a.other <> null
  +                        then a.other <- Array.append a.other [|family|]
  +                        else a.other <- [|family|]
  +                    a)
  +                        
  +//            for pair in setP do
  +//                match pair.Ast with
  +//                | :? AST as a -> 
  +//                    if parser.LeftSide.[a.first.prod] = currentNonTerm && a.extension = extension
  +//                    then
  +//                        wasAdded <- a.first.Equals family || (a.other <> null && a.other |> Array.exists(family.Equals))                        
  +//                        if not wasAdded
  +//                        then
  +//                            if a.other <> null
  +//                            then a.other <- Array.append a.other [|family|]
  +//                            else a.other <- [|family|]
  +//                        result := Some a
  +//                | _ -> failwith "Unexpected type of tree."
  +
               let result =
  -                match !result with
  +                match result with
                   | Some tree -> tree
                   | None -> new AST(family, null, extension)
               result
  
positive.code:         | :? IntermidiateNode as iN ->
              iN.Position.ToString()
          | null -> "n"
          | :? Nodes as n -> (takeHighBits n.extension).ToString() + (takeLowBits n.extension).ToString() 
          | _ -> failwith "Unexpected ast"
  
      let rec dfs (u : Vertex) =
  
negative.code:                                     let newLabel = packToInt64 rule 0
                                      addContext newLabel !currentIndex !currentGSSNode dummy    
                                  table.[index] |> Array.iter a
                      else condition := true
                                      
                  else
                      let curRight = unbox <| !currentN
                      let resTree, extension = handleIntermidiate curRight (rule)
                      let resTree = findTree rule extension resTree
                      if  resTree.extension = finalExtension && rule = parser.Startrule
                      then resultAST := Some resTree
                      pop !currentGSSNode !currentIndex resTree
          let control () =
  