Refactoring towards getting tokens