more graceful and secure command implementation