Optimize tokenize

In theory this should be a marked improvement, you might want to add some benchmarks to the repo though :)