another refactoring of get_quotes_from_words