Refactor tokenizing to put all the logic in the model where it belongs