made count-words function simpler.