Improve code style.
Remove duplicated command.
Tighten check of command-ness.