implemented check_words