working version with batchtask