Updated Command mode detection