Added exit on iterations
Updated patch