Updated batch logic