isValidCommand  checks entire command