Better use of runCommand function