optimised If statement

optimised `If` statement