Changed cmd execution logic.