A little more elegant.
I think I finally found a solution that is efficient and flexible. I'm sure I screwed something up though.
log_check reorg