cleanup and refactoring
cleaned up prefixTree