optimized getnext , used consume