changed the order of conditionals.

I believe the new order will be more optimal because it will save
some unneccessary comparisons.