Tokenlib

this is a redo of #2