Minor cleanup

- test commands directly instead of using temporary variable
- test command directly instead of exit variable