working on tokens logic