Made code more Pythonic, cleaner. Only stylistic changes,
no algorithmic changes.