Working version with chunks.