py3 compatible and PEP 8'd

In Python 3, map returns an iterable object of type map, and not a subscriptible. I updated the two instances of map to produce a list, and performed some minor PEP8 changes.