fixes for Python 3, add copyright, misc stylistic fixes