Clean up code formatting, add comments
Updates #25272