added next token function