Removed all dependence on os.system (replaced with subprocess.call) and unnecessary safeguards