change set 'wordsFound' from a global to a parameter