Huge fixes to batches

Hopefully it works perfectly, but it probably needs simplifying
Add test cases to tests