Updated comments and improved readability