implemented extract_words