A bunch of code cleanups to satisfy PyCharm