isLegalCommand + switch to integer