roughly impled cutTree