Here's the logic I'm talking about: I think my latest version got lost in a merge.