Variable threshold and max length