Refactor simple token code.