added new parameter for number per batch