Converted to 4 spaces indent, fixed minor style issues and pylint warnings.