anchor.diff:  	end,
      lists:map(fun(T) ->map(F, T) end, Body).
   	    
  -vann_clause(C, Env) ->
  +vann_clause(C, Env, Ms, VI) ->
       {Ps, {Bound1, Free1}} =
  -	vann_patterns(refac_syntax:clause_patterns(C), Env),
  +	vann_patterns(refac_syntax:clause_patterns(C), Env, Ms, VI),
       Env1 = ordsets:union(Env, Bound1),
       %% Guards cannot add bindings
       {G1, _, Free2} = case refac_syntax:clause_guard(C) of
   		       none -> {none, [], []};
  -		       G -> vann(G, Env1)
  +		       G -> vann(G, Env1, Ms, VI)
   		     end,
       {Es, {Bound2, Free3}} =
  -	vann_body(refac_syntax:clause_body(C), Env1),
  +	vann_body(refac_syntax:clause_body(C), Env1, Ms, VI),
       Bound = ordsets:union(Bound1, Bound2),
       Free = ordsets:union(Free1,
   			 ordsets:subtract(ordsets:union(Free2, Free3), Bound1)),
       Tree1 = rewrite(C, refac_syntax:clause(Ps, G1, Es)),
       {ann_bindings(Tree1, Env, Bound, Free), Bound, Free}.
   
  -vann_fun_expr_clause(C, Env) ->
  +vann_fun_expr_clause(C, Env, Ms, VI) ->
       {Ps, {Bound1, Free1}} =
   	vann_fun_expr_patterns(refac_syntax:clause_patterns(C),
  -			       Env),
  -    Env0 = ordsets:filter(fun ({V, _}) ->
  -				  case lists:keysearch(V, 1,
  -						       ordsets:to_list(Bound1))
  -				      of
  -				    {value, _} -> false;
  -				    false -> true
  -				  end
  -			  end,
  -			  Env),
  +			       Env, Ms, VI),
  +    Env0 =([{V, P} ||{V, P} <-Env, lists:keysearch(V, 1, Bound1)==false]),
       Env1 = ordsets:union(Env0, Bound1),
       %% Guards cannot add bindings
       {G1, _, Free2} = case refac_syntax:clause_guard(C) of
   		       none -> {none, [], []};
  -		       G -> vann(G, Env1)
  +		       G -> vann(G, Env1, Ms, VI)
   		     end,
       {Es, {Bound2, Free3}} =
  -	vann_body(refac_syntax:clause_body(C), Env1),
  +	vann_body(refac_syntax:clause_body(C), Env1, Ms, VI),
       Bound = ordsets:union(Bound1, Bound2),
       Free = ordsets:union(Free1,
   			 ordsets:subtract(ordsets:union(Free2, Free3), Bound1)),
       Tree1 = rewrite(C, refac_syntax:clause(Ps, G1, Es)),
       {ann_bindings(Tree1, Env, Bound, Free), Bound, Free}.
   
  -vann_clauses_join(Env) ->
  +vann_clauses_join(Env, Ms, VI) ->
       fun (C, {Bound, Free}) ->
  -	    {C1, Bound1, Free1} = vann_clause(C, Env),
  - %% 	    Bd1 = ordsets:filter(fun ({V, _}) ->
  -%%  					 case lists:keysearch(V, 1,
  -%%  							      ordsets:to_list(Bound1))
  -%%  					     of
  -%%  					   {value, _} -> true;
  -%%  					   false -> false
  -%%  					 end
  -%%  				 end,
  -%%  				 Bound),
  -%%  	    Bd2 = ordsets:filter(fun ({V, _}) ->
  -%%  					 case lists:keysearch(V, 1,
  -%%  							      ordsets:to_list(Bound))
  -%%  					     of
  -%%  					   {value, _} -> true;
  -%%  					   false -> false
  -%%  					 end
  -%%  				 end,
  -%%  				 Bound1),
  -	    
  -	    {C1,{ordsets:union(Bound, Bound1), ordsets:union(Free, Free1)}};
  +	    {C1, Bound1, Free1} = vann_clause(C, Env, Ms, VI),
  + 	    {C1,{ordsets:union(Bound, Bound1), ordsets:union(Free, Free1)}};
   	(C, false) ->
  -	    {C1, Bound, Free} = vann_clause(C, Env),
  +	    {C1, Bound, Free} = vann_clause(C, Env,Ms, VI),
   	    {C1, {Bound, Free}}
       end.
   
  -vann_fun_expr_clauses_join(Env) ->
  +vann_fun_expr_clauses_join(Env, Ms, VI) ->
       fun (C, {Bound, Free}) ->
  -	    {C1, Bound1, Free1} = vann_fun_expr_clause(C, Env),
  +	    {C1, Bound1, Free1} = vann_fun_expr_clause(C, Env, Ms, VI),
   	    {C1,
   	     {ordsets:intersection(Bound, Bound1),
   	      ordsets:union(Free, Free1)}};
   	(C, false) ->
  -	    {C1, Bound, Free} = vann_fun_expr_clause(C, Env),
  +	    {C1, Bound, Free} = vann_fun_expr_clause(C, Env, Ms, VI),
   	    {C1, {Bound, Free}}
       end.
   
  -vann_clauses(Cs, Env) ->
  -    lists:mapfoldl(vann_clauses_join(Env), false, Cs).
  -
  -vann_fun_expr_clauses(Cs, Env) ->
  -    lists:mapfoldl(vann_fun_expr_clauses_join(Env), false,
  +vann_clauses(Cs, Env, Ms, VI) ->
  +    lists:mapfoldl(vann_clauses_join(Env, Ms, VI), false, Cs).
  +
  +vann_fun_expr_clauses(Cs, Env, Ms, VI) ->
  +    lists:mapfoldl(vann_fun_expr_clauses_join(Env, Ms, VI), false,
   		   Cs).
   
   ann_bindings(Tree, Env, Bound, Free) ->
  
positive.code: 	    {ann_bindings(Tree1, Env, Bound, Free), Bound, Free}
      end.
  
  vann_list_comp(Tree, Env) ->
      Es = refac_syntax:list_comp_body(Tree),
      {Es1, {Bound1, Free1}} = vann_list_comp_body(Es, Env),
      % begin of modification by Huiqing Li
      Env0 = ordsets:filter(fun ({V, _}) ->
  				  case lists:keysearch(V, 1,
  						       ordsets:to_list(Bound1))
  				      of
  				    {value, _} -> false;
  				    false -> true
  				  end
  			  end,
  			  Env),
      Env1 = ordsets:union(Env0, Bound1),
      % Original code:
      % Env1 = ordsets:union(Env, Bound1),
      % end of modification by Huiqing Li
      T = refac_syntax:list_comp_template(Tree),
      {T1, _, Free2} = vann(T, Env1),
      Free = ordsets:union(Free1,
  			 ordsets:subtract(Free2, Bound1)),
      Bound = [],
      Tree1 = rewrite(Tree, refac_syntax:list_comp(T1, Es1)),
      {ann_bindings(Tree1, Env, Bound, Free), Bound, Free}.
  
  vann_list_comp_body_join() ->
      fun (T, {Env, Bound, Free}) ->
  	    {T1, Bound1, Free1} = case refac_syntax:type(T) of
  				    generator -> vann_generator(T, Env);
  				    _ ->
  					%% Bindings in filters are not
  					%% exported to the rest of the
  					%% body.
  					{T2, _, Free2} = vann(T, Env),
  					{T2, [], Free2}
  				  end,
  	    % Begin of modification by Huiqing
  	    Env0 = ordsets:filter(fun ({V, _}) ->
  					  case lists:keysearch(V, 1,
  							       ordsets:to_list(Bound1))
  					      of
  					    {value, _} -> false;
  					    false -> true
  					  end
  				  end,
  				  Env),
  	    Env1 = ordsets:union(Env0, Bound1),
  	    % Original code.
  	    %Env1 = ordsets:union(Env, Bound1),
  	    % End of modificaiton by Huiqing Li
  	    % Begin of modification by Huiqing
  	    Bound2 = ordsets:filter(fun ({V, _}) ->
  					    case lists:keysearch(V, 1,
  								 ordsets:to_list(Bound1))
  						of
  					      {value, _} -> false;
  					      false -> true
  					    end
  				    end,
  				    Bound),
  	    {T1,
  	     {Env1, ordsets:union(Bound2, Bound1),
  	      ordsets:union(Free, ordsets:subtract(Free1, Bound))}}
      end.
  
              %End of modificaiton by Huiqing Li
  	    % original code.
  	    %%  {T1, {Env1, ordsets:union(Bound, Bound1),
  	    %         ordsets:union(Free,
  	    %                     ordsets:subtract(Free1, Bound))}}
  
  vann_list_comp_body(Ts, Env) ->
      F = vann_list_comp_body_join(),
      {Ts1, {_, Bound, Free}} = lists:mapfoldl(F,
  					     {Env, [], []}, Ts),
      {Ts1, {Bound, Free}}.
  
negative.code: 	case refac_syntax:type(MacroHead) of 
  	    application -> Operator = refac_syntax:application_operator(MacroHead),
  			   Arguments = refac_syntax:application_arguments(MacroHead),
  			   {Operator1, Bs1, _Fs1} = vann_pattern(Operator, Env, Ms, VI),
  			   {Arguments1, {Bs2, _Fs2}} = vann_patterns(Arguments, Env, Ms, VI), 
  	                   %%Bs3= ordsets:union(Bs1, Bs2),
  			   H = rewrite(MacroHead, refac_syntax:application(Operator1, Arguments1)),
  			   %%{{ann_bindings(H, Env, Bs3, []), Bs3, []}, Bs1};
  			   {{ann_bindings(H, Env, Bs2, []), Bs2, []}, Bs1};
  	    _  -> {vann_pattern(MacroHead, Env, Ms, VI),[]}
  	end,
      Env1 = ordsets:union(Env, Bound),
      {MacroBody1, {_Bound1, _Free1}} = vann_body(MacroBody, Env1, Ms, VI),
      MacroBody2 = adjust_define_body(MacroBody1, Env1),
      D1 = rewrite(D, refac_syntax:attribute(Name, [MacroHead1| MacroBody2])),
      {ann_bindings(D1, Env, [], []), [], []}.   
  