Updated the script to use the batteries and follow pep8

Cleaned up the code a bit per pep8. Added OptionParser to handle clargs. Added __main__ invocation.