write load_words function