Modified the script to use less os.popen calls and more Python utilities.