write batch optimizations