added batch function