centralize the pruning work