various batch optimizations