It was at about this point in this function that I completely lost all awareness of what was going on. This function is too long, too cryptic, and poorly commented.