refactor the tokenizer