Changed WordSplitter.m to a function