Implemented advanced pruning algorithm.