Extract run_cmd(). Introduce config, guard imports