add comments to chunking routine
split doChunk method out into standalone, loses closure advantages but a bit neater