Fixed errors suggested by pep8/pylint. Still to-do: write more tests.