NB: Most changes here are restructuring for efficiency. Pre-sorting the callbacks (more commonly there will be only 1), and popping off next index to callback.

BUT - there was also a bug here, that it called the callback for position it wanted, after row and write stream had , i.e. pos+1, resulting in 1 less row being read back from the stream than should have been.