logic changed minorly