new version, which adds batch_size