Added internal chunk_map utility function