#413 Improved code formatting and comments