use set for pruning