Limit for emergency break reduced to 5000 to avoid memory errors.