refactor tokenizer as a module