modified function length and contains to include the word list