Modified if condition for blank spaces