reverted to per-chunk calculation of prod due to memory issues