Simpler processCommand function