added condition to commands (issue #2)