improving the Hash type to work on batches, and produce sorted output.
with tests