Changed for-loop

Tried to make the code more efficient. Now checks for length of text
string to determine the relevance.