Adding batch upper limit and unit test