cleanup pruning code a bit, better logging