Code formatting and improved comments