Should be a class instance variable in Token
refactor out the library functions
Refactor libraries and add more tests