Added batch size as a parameter