WIP. Working in token allocation as first step of refactoring.