changed breakout logic