Modify script to take table name instead of query.
Some PEP8 fixes.