Spruced up "isLegalCommand"