modularized runCommand