Improved code style and fixed linting errors