Batching

Closes #282
In particular, the `RefCell` is safe here because references into the refcells are never returned, and the refcell usage is completely local to these methods, can verify manually that the borrow invariants are kept. (How it's written now, but with added `.get_mut()`s is fine)