further editing of wordcount script

Functions work as intended, however calling them appears to malfunction.
Unsure of problem as code has been provided for me an is not familiar.