Use some of the Python 3 syntax

* Python 3 has some good syntax changes, so why not port them to 2.x when I have the chance?
* Minor cleanup.