Fixed several issues; see RELEASENOTES.md for a full list.

Also did a major cleanup of the code to make it a little more PEP8-friendly.