Refactored to remove code style errors and warnings.