Solved some problems with filtering words, there were memory leaks