Improved chunked encoding