next logic changed