edited getNextToken