passing trees by reference, not value