Fixed error of extra spaces being introduced as parts of the tokenized words. Fixed sort function to work properly with text, as well as non-English text. Edited tests to pass the sort function properly.