pruning mechanism implemented, compiles perfectly but has segmentation faults. Needs a review.