implement pruning