Refactored crossword solver