seperated out nextToken method