Changed logic to ignore whitespace before words.