Cleaning up the script. Much more maintainable. PEP 8 compliant for the most part