Added stop criteria