Changed code in add_words function