A few small bug fixes and adjust all indentation to match PEP 8 guidelines (4
spaces per indent level).