Better word splittign algorithm