Cleaned up wordcount code a bit