Add tests for concurrent chunking. Refactor.