Style changes

Got rid of an if/else that should just be ternary assignment.
Got rid of some loops that can be represented as maps or list
comprehensions.