Improved comments throughout the code