Smarten up the token-reader, and add a test loop.