really optimized sweep-prune