Refactor Token into a model, add tests