Clean chunking code