As I was testing it, this seemed like it would be more resistant to edge cases, more consistent in expected behavior, and the logic is simpler and easier to understand.