Clean up code

so that it passes a linter such as PEP8/pyflakes