Optimization the order of commands in the protocol