Some code cleanup, courtesy of PyCharm