refactor MsgCommand()