refactored to *not* use batch mode, for simplicity. my real application does use batch mode AND streams, though.