processCommand method fixed