Given the reason for this PR, and the possibility of introducing an error down the road, could you add a comment here explaining why the order matters?  Also, while you're in there, I would prefer to see "else if" together on the same line.