wc.c moved some duplicated code into functions