switched from using shift for the cursor due to bad slowdown on big batchSizes as shift causes entire array to be copied on each call.