Updated command mode parsing