cleaned up code, pylint: 3.58