Updated to use subprocess instead of os.system