support for command batching on client side (code from Mittie)