simplifying the if conditions

simplifying the if conditions