Added batching and some better tests.