move scanning routine from token class into script class