After you change to only accept a single command, this logic is drastically simpler. Thor will handle all this custom validation.