Command optimization