Refactored /command processing.