This is Nathans changes that didnt post properly and some minor edits to
the AB pruning code