Improving comments and formatting