Improved comments and formatting