Fixed prune function so also prunes priors, likelihoods, etc.