changed from popen to subprocess