Improved code style and PEP8 conformance