• Nice question, thanks.

    Though I think formatting the code into little sections, and including the commented select statements, makes it a little more confusing and harder to read than it could have been.