anchor.diff:  				  refac_syntax:macro_arguments(Tree)
   				    of
   				  none -> {none, {[], []}};
  -				  As1 -> vann_patterns(As1, Env)
  +				  As1 -> vann_patterns(As1, Env, Ms, VI)
   				end,
   	  N = refac_syntax:macro_name(Tree),
   	  Tree1 = rewrite(Tree, refac_syntax:macro(N, As)),
   	  {ann_bindings(Tree1, Env, Bound, Free), Bound, Free};
         _Type ->
  -	  F = vann_patterns_join(Env),
  +	  F = vann_patterns_join(Env, Ms, VI),
   	  {Tree1, {Bound, Free}} = mapfold_subtrees(F, {[], []},
   						    Tree),
   	  {ann_bindings(Tree1, Env, Bound, Free), Bound, Free}
       end.
   
  -vann_fun_expr_pattern(Tree, Env) ->
  +vann_fun_expr_pattern(Tree, Env,Ms, VI) ->
       case refac_syntax:type(Tree) of
         variable ->
  -	  V = refac_syntax:variable_name(Tree),
  -	  Pos = refac_syntax:get_pos(Tree),
  -	  case lists:keysearch(V, 1, Env) of
  -	    {value, {V, _}} ->
  -		%% shandowing
  -		Bound = [{V, Pos}],
  -		Free = [],
  -		Def = [Pos],
  -		{ann_bindings(Tree, Env, Bound, Free, Def), Bound, Free};
  -	    false ->
  -		%% binding occurrence
  -		Bound = [{V, Pos}],
  -		Free = [],
  -		Def = [Pos],
  -		{ann_bindings(Tree, Env, Bound, Free, Def), Bound, Free}
  -	  end;
  -      match_expr ->
  +	    V = refac_syntax:variable_name(Tree),
  +	    P = refac_syntax:get_pos(Tree),
  +	    case VI of 
  +		[] -> Bound = [{V, P}],
  +		      Free = [],
  +		      Def = [P],
  +		      {ann_bindings(Tree, Env, Bound, Free, Def), Bound, Free};		
  +		_ ->
  +		    case lists:keysearch({V, P}, 1, VI) of
  +			{value, {{V, P}, As}} ->
  +			    {value, {bound, Bound1}} = lists:keysearch(bound, 1,As),
  +			    {value, {free, Free1}} = lists:keysearch(free, 1,As),
  +			    {value, {def, Def1}} = lists:keysearch(def, 1,As),
  +			    {value, {env, Env1}} = lists:keysearch(env, 1,As),
  +			    {ann_bindings(Tree, Env1, Bound1, Free1, Def1), Bound1, Free1};
  +			false -> 
  +			    throw("Wrangler AST annotation error!")
  +		    end
  +	    end;
  +	match_expr ->
   	  %% Alias pattern
   	  P = refac_syntax:match_expr_pattern(Tree),
  -	  {P1, Bound1, Free1} = vann_pattern(P, Env),
  +	  {P1, Bound1, Free1} = vann_pattern(P, Env, Ms, VI),
   	  E = refac_syntax:match_expr_body(Tree),
  -	  {E1, Bound2, Free2} = vann_pattern(E, Env),
  +	  {E1, Bound2, Free2} = vann_pattern(E, Env, Ms, VI),
   	  Bound = ordsets:union(Bound1, Bound2),
   	  Free = ordsets:union(Free1, Free2),
   	  Tree1 = rewrite(Tree, refac_syntax:match_expr(P1, E1)),
  
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:     {ann_bindings(Tree1, Env, Bound, Free), Bound,Free}.    %% TODO: NEED TO CHANGE THIS BACK.
      %% erlang:error({not_implemented, try_expr}).
  
  vann_receive_expr(Tree, Env, Ms, VI) ->
      %% The timeout action is treated as an extra clause.
      %% Bindings in the expiry expression are local only.
      Cs = refac_syntax:receive_expr_clauses(Tree),
      Es = refac_syntax:receive_expr_action(Tree),
      case Es of 
  	[] ->
  	    {Cs1,{Bound, Free}} = vann_clauses(Cs, Env, Ms, VI),
  	    Tree1 = rewrite(Tree, refac_syntax:receive_expr(Cs1, none, [])),
  	    {ann_bindings(Tree1, Env, Bound, Free), Bound, Free};
  	_ ->
  	    C = refac_syntax:clause([], Es),
  	    {[C1 | Cs1], {Bound, Free1}} = vann_clauses([C | Cs],
  							Env, Ms, VI),
  	    Es1 = refac_syntax:clause_body(C1),
  	    {T1, _, Free2} = case
  		       refac_syntax:receive_expr_timeout(Tree)
  			 of
  		       none -> {none, [], []};
  		       T -> vann(T, Env, Ms, VI)
  		     end,
  	    Free = ordsets:union(Free1, Free2),
  	    Tree1 = rewrite(Tree,
  