Some pep8 cleanup.  Changed some for loops to comprehensions.