Minor improvements and code formatting