Use count_words() for counting in write_logs()