used subprocess.popen so commands can be directed to stdout.