improved if statement

made the if statement less confusing