Automatic reformatting from PyCharm and a few small fixes.