base code for wordsearch