added chunkSize argument