Added wordcount function and its unit tests