token reader and tests