batch function upgraded