anchor.diff:  	    erlang:error(E)
       end,
   
  +    %% basic sanity check of MasterNode
  +    case check_node_has_tables(MasterNode, [phone, user, numbers, regexproute]) of
  +	true ->
  +	    ok;
  +	false ->
  +	    io:format("~nERROR: Master node ~p does not have disc_copies of basic YXA tables, "
  +		      "is it really an YXA db node?~n~n", [MasterNode]),
  +	    erlang:error("bad master node")
  +    end,
  +
       AllTables = [schema | ?MNESIA_TABLES],
  -
  -    io:format("* Waiting for tables : ~w~n", [AllTables]),
  -    ok = mnesia:wait_for_tables(AllTables, 60 * 1000),
  -
  -    io:format("* Replicating ~p tables :~n", [length(AllTables)]),
  -    ok = replicate_tables(AllTables),
  +    %% Only wait for tables present on MasterNode. This makes it possible to upgrade
  +    %% an YXA installation to a new version with more tables by adding new replicas.
  +    %% This might not be safe to do though, but having the option is nice. Be warned!
  +    WaitTables = lists:filter(fun(T) ->
  +				      check_node_has_tables(MasterNode, [T])
  +			      end, AllTables),
  +
  +    ok = my_wait_for_tables(WaitTables, 60 * 1000),
  +
  +    io:format("* Replicating ~p tables :~n", [length(WaitTables)]),
  +    ok = replicate_tables(WaitTables),
   
       io:format("~nReplica created successfully.~n~n"),
       ok.
   
  -
   replicate_tables([H | T]) ->
  -    case lists:member(node(), mnesia:table_info(H, disc_copies)) of
  +    case check_node_has_tables(node(), [H]) of
   	true ->
   	    io:format("~25w: Table is already present on disc at node ~p~n", [H, node()]);
   	false ->
  
positive.code:     io:format("* Creating tables on this Mnesia node (~p)~n", [node()]),
      init_db_module(?DB_MODULES, node()),
   
      ok = mnesia:wait_for_tables(?MNESIA_TABLES, 10000),
  
      io:format("* Updating any pre-existing table definitions~n"),
      ok = table_update:update(),
  
negative.code: 		true ->
  		    ok;
  		false ->
  		    io:format("~nERROR: Failed connecting to master node - Erlang distribution problem? "
  			      "Are you running SSL on the master node but not on this?~n~n"),
  		    erlang:error("connect to master node failed")
  	    end;
  	{ok, [MasterNode]} ->
  	    ok;
  