new rerooting method and script for rerooting against a master tree